| | |
| | | "@vue-office/excel": "^1.7.14", |
| | | "@vue/composition-api": "^1.7.2", |
| | | "axios": "0.28.1", |
| | | "big.js": "^6.2.2", |
| | | "clipboard": "2.0.8", |
| | | "core-js": "3.37.1", |
| | | "dom-to-image": "^2.6.0", |
| | |
| | | #app { |
| | | |
| | | .main-container { |
| | | height: 100%; |
| | | transition: margin-left 0.28s; |
| | | transition: margin-left .28s; |
| | | margin-left: $base-sidebar-width; |
| | | position: relative; |
| | | } |
| | | |
| | | .sidebarHide { |
| | | margin-left: 0 !important; |
| | | margin-left: 0!important; |
| | | } |
| | | |
| | | .sidebar-container { |
| | | -webkit-transition: width 0.28s; |
| | | -webkit-transition: width .28s; |
| | | transition: width 0.28s; |
| | | width: $base-sidebar-width !important; |
| | | background-color: $base-menu-background; |
| | |
| | | left: 0; |
| | | z-index: 1001; |
| | | overflow: hidden; |
| | | -webkit-box-shadow: 2px 0 6px rgba(0, 21, 41, 0.35); |
| | | -webkit-box-shadow: 2px 0 6px rgba(0,21,41,.35); |
| | | //box-shadow: 2px 0 6px rgba(0,21,41,.35); |
| | | |
| | | // reset element-ui css |
| | | .horizontal-collapse-transition { |
| | | transition: 0s width ease-in-out, 0s padding-left ease-in-out, |
| | | 0s padding-right ease-in-out; |
| | | transition: 0s width ease-in-out, 0s padding-left ease-in-out, 0s padding-right ease-in-out; |
| | | } |
| | | |
| | | .scrollbar-wrapper { |
| | |
| | | width: 100% !important; |
| | | } |
| | | |
| | | .el-menu-item, |
| | | .el-submenu__title { |
| | | .el-menu-item, .el-submenu__title { |
| | | overflow: hidden !important; |
| | | text-overflow: ellipsis !important; |
| | | white-space: nowrap !important; |
| | |
| | | .submenu-title-noDropdown, |
| | | .el-submenu__title { |
| | | &:hover { |
| | | background-color: rgba(0, 0, 0, 0.06) !important; |
| | | background-color: rgba(0, 0, 0, 0.08) !important; |
| | | } |
| | | } |
| | | |
| | |
| | | color: $base-menu-color-active !important; |
| | | } |
| | | |
| | | & .nest-menu .el-submenu > .el-submenu__title, |
| | | & .nest-menu .el-submenu>.el-submenu__title, |
| | | & .el-submenu .el-menu-item { |
| | | min-width: $base-sidebar-width !important; |
| | | |
| | | &:hover { |
| | | background-color: rgba(0, 0, 0, 0.06) !important; |
| | | background-color: rgba(0, 0, 0, 0.08) !important; |
| | | } |
| | | } |
| | | |
| | | & .theme-dark .nest-menu .el-submenu > .el-submenu__title, |
| | | & .theme-dark .nest-menu .el-submenu>.el-submenu__title, |
| | | & .theme-dark .el-submenu .el-menu-item { |
| | | background-color: $base-sub-menu-background !important; |
| | | |
| | |
| | | .el-submenu { |
| | | overflow: hidden; |
| | | |
| | | & > .el-submenu__title { |
| | | &>.el-submenu__title { |
| | | padding: 0 !important; |
| | | |
| | | .svg-icon { |
| | |
| | | height: 1.5em; |
| | | margin-left: 25px; |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | .el-menu--collapse { |
| | | .el-submenu { |
| | | & > .el-submenu__title { |
| | | &>.el-submenu__title { |
| | | height: auto; /* æ ¹æ®å
容èªå¨è°æ´é«åº¦ */ |
| | | flex-direction: column; /* æ¹åå¸å±æ¹å为åç´ */ |
| | | align-items: center; /* å±
ä¸å¯¹é½ */ |
| | | margin-bottom: 10px; |
| | | & > span { |
| | | &>span { |
| | | display: block !important; |
| | | visibility: visible !important; |
| | | white-space: normal; /* å
许æ¢è¡ */ |
| | |
| | | } |
| | | |
| | | .sidebar-container { |
| | | transition: transform 0.28s; |
| | | transition: transform .28s; |
| | | width: $base-sidebar-width !important; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | .withoutAnimation { |
| | | |
| | | .main-container, |
| | | .sidebar-container { |
| | | transition: none; |
| | |
| | | |
| | | // when menu collapsed |
| | | .el-menu--vertical { |
| | | & > .el-menu { |
| | | &>.el-menu { |
| | | .svg-icon { |
| | | margin-right: 16px; |
| | | } |
| | | } |
| | | |
| | | .nest-menu .el-submenu > .el-submenu__title, |
| | | .nest-menu .el-submenu>.el-submenu__title, |
| | | .el-menu-item { |
| | | &:hover { |
| | | // you can use $subMenuHover |
| | |
| | | } |
| | | |
| | | // the scroll bar appears when the subMenu is too long |
| | | > .el-menu--popup { |
| | | >.el-menu--popup { |
| | | max-height: 100vh; |
| | | overflow-y: auto; |
| | | |
| | |
| | | if (state) { |
| | | this.imgUrl = this.fileUrl.replaceAll('word', 'img') |
| | | } |
| | | console.log(2222, this.imgUrl) |
| | | return state; |
| | | }, |
| | | isPdf() { |
| | |
| | | |
| | | <el-table-column v-for="(item, index) in column" :key="index" :column-key="item.columnKey" |
| | | :filter-method="item.filterHandler" :filter-multiple="item.filterMultiple" :filtered-value="item.filteredValue" |
| | | :filters="item.filters" :fixed="item.fixed" :label="item.label" :min-width="item.minWidth" :prop="item.prop" |
| | | :show-overflow-tooltip="item.dataType === 'action' || item.dataType === 'slot' ? false : true" |
| | | :sortable="item.sortable ? true : false" :type="item.type" |
| | | :width="item.dataType == 'action' ? btnWidth : item.width" align="center"> |
| | | :filters="item.filters" :fixed="item.fixed" :label="item.label" :prop="item.prop" |
| | | :show-overflow-tooltip="item.dataType === 'action' || item.dataType === 'slot' ? false : true" |
| | | :min-width="item.dataType == 'action' ? btnWidth : getTitleWidth(item)" |
| | | :sortable="item.sortable ? true : false" :type="item.type" :width="item.dataType == 'action' ? btnWidth : getTitleWidth(item)" align="center"> |
| | | <!-- <div class="123" v-if="item.type == ''"> --> |
| | | <template v-if="item.hasOwnProperty('colunmTemplate')" :slot="item.colunmTemplate" slot-scope="scope"> |
| | | <slot v-if="item.theadSlot" :index="index" :name="item.theadSlot" :row="scope.row" /> |
| | |
| | | </div> |
| | | |
| | | <!-- æé® --> |
| | | <div v-else-if="item.dataType == 'action'" :style="`width:${getWidth(item.operation, scope.row)}`"> |
| | | <div v-else-if="item.dataType == 'action'" |
| | | :style="`width:${getWidth(item.operation, scope.row)}`"> |
| | | <template v-for="(o, key) in item.operation"> |
| | | <el-button v-show="o.type != 'upload'" size="mini" v-if="o.showHide ? o.showHide(scope.row) : true" |
| | | :disabled="o.disabled ? o.disabled(scope.row) : false" :icon="iconFn(o)" :plain="o.plain" |
| | |
| | | {{ o.name }} |
| | | </el-button> |
| | | <el-upload :action="javaApi + o.url + '?id=' + (o.uploadIdFun ? o.uploadIdFun(scope.row) : scope.row.id)" |
| | | size="mini" ref="upload" :multiple="o.multiple ? o.multiple : false" :limit="1" |
| | | :key="uploadKeys[scope.$index]" |
| | | ref="uploadRef" |
| | | size="mini" :multiple="o.multiple ? o.multiple : false" :limit="1" |
| | | :disabled="o.disabled ? o.disabled(scope.row) : false" :accept="o.accept |
| | | ? o.accept |
| | | : '.jpg,.jpeg,.png,.gif,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip,.rar' |
| | | " v-if="o.type == 'upload'" style="display: inline-block; width: 50px" |
| | | v-show="o.showHide ? o.showHide(scope.row) : true" :headers="uploadHeader" :on-error="onError" |
| | | :on-exceed="onExceed" :on-success="handleSuccessUp" :show-file-list="false" :key="key"> |
| | | v-show="o.showHide ? o.showHide(scope.row) : true" :headers="uploadHeader" |
| | | :before-upload="(file) => beforeUpload(file, scope.$index)" |
| | | :on-change="(file, fileList) => handleChange(file, fileList, scope.$index)" |
| | | :on-error="(error, file, fileList) => onError(error, file, fileList, scope.$index)" |
| | | :on-success="(response, file, fileList) => handleSuccessUp(response, file, fileList, scope.$index)" |
| | | :on-exceed="onExceed" :show-file-list="false"> |
| | | <el-button :size="o.size ? o.size : 'small'" type="text" |
| | | :disabled="o.disabled ? o.disabled(scope.row) : false">{{ o.name }}</el-button> |
| | | </el-upload> |
| | |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <pagination v-if="page" v-show="page.total > 0" :total="page.total" :layout="page.layout" :page.sync="page.current" |
| | | <pagination v-show="page.total > 0" :total="page.total" :layout="page.layout" :page.sync="page.current" |
| | | :limit.sync="page.size" @pagination="pagination" /> |
| | | </div> |
| | | </template> |
| | |
| | | name: "ZTTable", |
| | | filters: { |
| | | typeFn(val, row) { |
| | | // console.log(val, row, '11111111'); |
| | | if (typeof val === "function") { |
| | | return val(row); |
| | | } else return val; |
| | |
| | | data() { |
| | | return { |
| | | spanList: [], |
| | | btnWidth: '120px', |
| | | btnWidth: "120px", |
| | | uploadRefs: [], |
| | | currentFiles: {}, // ç¨äºå卿¯è¡çå½åæä»¶ |
| | | uploadKeys: {} // ç¨äºå¨æéç½®ç»ä»¶ |
| | | }; |
| | | }, |
| | | mounted() { |
| | | this.calculateSpanInfo(); |
| | | this.$nextTick(() => { |
| | | this.$refs.multipleTable.doLayout(); |
| | | }); |
| | | this.tableData.forEach((_, index) => { |
| | | if (this.$refs.uploadRef) { |
| | | this.$refs.uploadRef[index] = this.$refs.uploadRef[index] || {}; |
| | | } |
| | | }); |
| | | }) |
| | | }, |
| | | watch: { |
| | | tableData: { |
| | | handler() { |
| | | // å½è¡¨æ ¼æ°æ®ååæ¶ï¼åå§å uploadKeys |
| | | this.tableData.forEach((_, index) => { |
| | | this.$set(this.uploadKeys, index, Date.now()); |
| | | }); |
| | | }, |
| | | immediate: true |
| | | } |
| | | }, |
| | | methods: { |
| | | getWidth(row) { |
| | | getWidth(row, row0) { |
| | | let count = 0; |
| | | row.forEach((a) => { |
| | | if (a.showHide !== undefined && a.showHide()) { |
| | | if (a.showHide !== undefined && a.showHide(row0)) { |
| | | count += a.name.length; |
| | | } else if (!a.showHide) { |
| | | count += a.name.length; |
| | | } |
| | | }); |
| | | this.btnWidth = count * 15 + 80 + "px"; |
| | | return count * 15 + 80 + "px"; |
| | | this.btnWidth = count * 15 + 50 + "px"; |
| | | return count * 15 + 50 + "px"; |
| | | }, |
| | | getTitleWidth(row) { |
| | | if (row.label.includes('æ¶é´') || row.label.includes('ç¼å·') || row.label.includes('æ ·ååç§°') || row.label.includes('é¶ä»¶')) { |
| | | return 160 |
| | | } else if (row.label.includes('æä½')) { |
| | | return row.width |
| | | } else { |
| | | const span = document.createElement('span'); |
| | | span.innerText = row.label; |
| | | document.body.appendChild(span); |
| | | const width = `${span.offsetWidth + 50}px`; |
| | | document.body.removeChild(span); |
| | | |
| | | return width; |
| | | } |
| | | }, |
| | | iconFn(row) { |
| | | if (row.name === "ç¼è¾" || row.name === "ä¿®æ¹") { |
| | |
| | | } else { |
| | | return row.icon; |
| | | } |
| | | // if (typeof (val) === 'function') { |
| | | // return val(row); |
| | | // } else return val; |
| | | }, |
| | | formatType(val, format) { |
| | | if (typeof format === "function") { |
| | |
| | | setCurrent(row) { |
| | | this.$refs.multipleTable.setCurrentRow(); |
| | | }, |
| | | handleSuccessUp(response, label) { |
| | | if (typeof label === "string") { |
| | | if (response.code == 200) { |
| | | this.upData[label] = response.data.url; |
| | | handleSuccessUp(response, file, fileList, index) { |
| | | if (response.code == 200) { |
| | | // æ¸
餿件åè¡¨å¹¶æ´æ°å½åæä»¶ |
| | | if (this.uploadRefs[index]) { |
| | | this.uploadRefs[index].clearFiles(); |
| | | } |
| | | this.currentFiles[index] = file; |
| | | this.$message.success("ä¸ä¼ æå"); |
| | | // éç½®ç»ä»¶ç¶æ |
| | | this.resetUploadComponent(index); |
| | | |
| | | } else { |
| | | if (response.code == 200) { |
| | | this.$message.success("ä¸ä¼ æå"); |
| | | } |
| | | this.$message.error(response.message); |
| | | } |
| | | }, |
| | | onError(err, file, fileList) { |
| | | this.$message.error("ä¸ä¼ 失败"); |
| | | this.$refs.upload.clearFiles(); |
| | | this.uploading = false; |
| | | resetUploadComponent(index) { |
| | | // 卿æ¹å key æ¥å¼ºå¶éç½®ç»ä»¶ |
| | | this.uploadKeys[index] = Date.now(); // ä½¿ç¨æ¶é´æ³ä½ä¸ºæ°ç key |
| | | }, |
| | | handleChange(file, fileList, index) { |
| | | // 妿æä»¶æ°éè¶
è¿éå¶ï¼ç§»é¤ææ©çæä»¶ |
| | | if (fileList.length > 1) { |
| | | // ç§»é¤ææ©çæä»¶ |
| | | const earliestFile = fileList[0]; |
| | | this.uploadRefs[index].handleRemove(earliestFile); |
| | | } |
| | | |
| | | // æ´æ°å½åæä»¶ |
| | | this.currentFiles[index] = file; |
| | | }, |
| | | beforeUpload (file, index) { |
| | | this.currentFiles[index] = {} |
| | | if (file.size > 1024 * 1024 * 10) { |
| | | this.$message.error('ä¸ä¼ æä»¶ä¸è¶
è¿10M'); |
| | | // this.$refs.upload.clearFiles() |
| | | return false; |
| | | } else { |
| | | return true; |
| | | } |
| | | }, |
| | | onError(error, file, fileList, index) { |
| | | this.$message.error('æä»¶ä¸ä¼ 失败ï¼è¯·éè¯'); |
| | | |
| | | // æ¸
餿件å表 |
| | | if (this.uploadRefs[index]) { |
| | | this.uploadRefs[index].clearFiles(); |
| | | } |
| | | }, |
| | | onExceed() { |
| | | this.$message.warning("è¶
åºæä»¶ä¸ªæ°"); |
| | |
| | | this.$emit("pagination", { page: page, limit: limit }); |
| | | }, |
| | | indexMethod(index) { |
| | | // return index * 2; |
| | | return (this.page.current - 1) * this.page.size + index + 1; |
| | | }, |
| | | // ç¹å»åå
æ ¼linkäºä»¶ |
| | |
| | | }; |
| | | } |
| | | } |
| | | // // ç¹æ®çåå¹¶è¡ |
| | | // if ( |
| | | // this.data.spanConfig != undefined && |
| | | // this.data.spanConfig.special && |
| | | // this.data.spanConfig.special.main && |
| | | // this.data.spanConfig.special.rows && |
| | | // this.data.spanConfig.special.rows.length > 0 |
| | | // ) { |
| | | // let i = null; |
| | | // let obj = this.data.spanConfig.special.rows.find((item, index) => { |
| | | // i = index; |
| | | // return item.index == columnIndex; |
| | | // }); |
| | | // if (obj) { |
| | | // const _row = this.specialSpanList[i].arr[rowIndex]; |
| | | // const _col = _row > 0 ? 1 : 0; |
| | | // return { |
| | | // rowspan: _row, |
| | | // colspan: _col, |
| | | // }; |
| | | // } |
| | | // } |
| | | }, |
| | | // åæ¾å¤ééä¸ç¶æ |
| | | toggleRowSelection(list) { |
| | | this.$nextTick(() => { |
| | | this.tableData.forEach(row => { |
| | | let obj = list.find(m => m == row[this.rowKey]) |
| | | if (obj) { |
| | | this.$refs.multipleTable.toggleRowSelection(obj, true); |
| | | } |
| | | }); |
| | | }); |
| | | } |
| | | }, |
| | | }; |
| | | </script> |
| | |
| | | text-align: center; |
| | | } |
| | | |
| | | .link { |
| | | color: rgb(64, 158, 255); |
| | | cursor: pointer; |
| | | } |
| | | >>>.cell { |
| | | padding: 0 !important; |
| | | } |
| | | |
| | | .cell { |
| | | white-space: nowrap; |
| | | overflow: hidden; |
| | |
| | | padding-left: 10px !important; |
| | | } |
| | | |
| | | .link { |
| | | color: rgb(64, 158, 255); |
| | | cursor: pointer; |
| | | } |
| | | |
| | | >>>.el-table__body-wrapper::-webkit-scrollbar { |
| | | height: 10px; |
| | | /* 设置æ»å¨æ¡å®½åº¦ */ |
| | | } |
| | | </style> |
| | | <style> |
| | | .lims-table .highlight-warning-row-border td:first-child { |
| | | border-left: 4px solid #ffcd29; |
| | | } |
| | |
| | | .lims-table .highlight-warning-row-border td:last-child { |
| | | border-right: 4px solid #ffcd29; |
| | | } |
| | | |
| | | /* .lims-table .highlight-danger-row-border td { |
| | | border-top: 2px solid red; |
| | | border-bottom: 2px solid red; |
| | | } */ |
| | | |
| | | .lims-table .highlight-danger-row-border td:first-child { |
| | | border-left: 4px solid #f56c6c; |
| | |
| | | // 渲æç« |
| | | drawStamps(x, y, index) { |
| | | var img = new Image(); |
| | | console.log(this.stampsName) |
| | | // 设置å¾çæº |
| | | img.src = require("@/assets/stamps/" + this.stampsName + ".png"); // æ¿æ¢ä¸ºä½ çå¾ç龿¥ |
| | | let that = this |
| | |
| | | <template> |
| | | <div v-if="!item.hidden"> |
| | | <template |
| | | v-if="hasOneShowingChild(item.children, item) && (!onlyOneChild.children || onlyOneChild.noShowingChildren) && !item.alwaysShow"> |
| | | <template v-if="hasOneShowingChild(item.children,item) && (!onlyOneChild.children||onlyOneChild.noShowingChildren)&&!item.alwaysShow"> |
| | | <app-link v-if="onlyOneChild.meta" :to="resolvePath(onlyOneChild.path, onlyOneChild.query)"> |
| | | <el-menu-item :index="resolvePath(onlyOneChild.path)" :class="{ 'submenu-title-noDropdown': !isNest }"> |
| | | <item :icon="onlyOneChild.meta.icon || (item.meta && item.meta.icon)" :title="onlyOneChild.meta.title" /> |
| | | <el-menu-item :index="resolvePath(onlyOneChild.path)" :class="{'submenu-title-noDropdown':!isNest}"> |
| | | <item :icon="onlyOneChild.meta.icon||(item.meta&&item.meta.icon)" :title="onlyOneChild.meta.title" /> |
| | | </el-menu-item> |
| | | </app-link> |
| | | </template> |
| | |
| | | <template slot="title"> |
| | | <item v-if="item.meta" :icon="item.meta && item.meta.icon" :title="item.meta.title" /> |
| | | </template> |
| | | <sidebar-item v-for="(child, index) in item.children" :key="child.path + index" :is-nest="true" :item="child" |
| | | :base-path="resolvePath(child.path)" class="nest-menu" /> |
| | | <sidebar-item |
| | | v-for="(child, index) in item.children" |
| | | :key="child.path + index" |
| | | :is-nest="true" |
| | | :item="child" |
| | | :base-path="resolvePath(child.path)" |
| | | class="nest-menu" |
| | | /> |
| | | </el-submenu> |
| | | </div> |
| | | </template> |
| | |
| | | |
| | | // Show parent if there are no child router to display |
| | | if (showingChildren.length === 0) { |
| | | this.onlyOneChild = { ...parent, path: '', noShowingChildren: true } |
| | | this.onlyOneChild = { ... parent, path: '', noShowingChildren: true } |
| | | return true |
| | | } |
| | | |
| | |
| | | ::v-deep .el-submenu__title i { |
| | | color: #ffffff !important; |
| | | } |
| | | </style> |
| | | </style> |
| | |
| | | |
| | | NProgress.configure({ showSpinner: false }) |
| | | |
| | | const whiteList = ['/login', '/register'] |
| | | const whiteList = ['/login', '/register', '/thirdpartylogin', '/logindemo'] |
| | | |
| | | const isWhiteList = (path) => { |
| | | return whiteList.some(pattern => isPathMatch(pattern, path)) |
| | |
| | | hidden: true, |
| | | }, |
| | | { |
| | | path: "", |
| | | path: "/", |
| | | component: Layout, |
| | | redirect: "index", |
| | | children: [ |
| | |
| | | * åå
¸è¯·æ±ï¼æ¹æ³ç¾å为function(dictMeta: DictMeta): Promise |
| | | */ |
| | | request: (dictMeta) => { |
| | | console.log(`load dict ${dictMeta.type}`) |
| | | return Promise.resolve([]) |
| | | }, |
| | | /** |
| | |
| | | let min = null; |
| | | if (val && val.length > 0) { |
| | | val = val.filter((item) => item != null && item !== ""); |
| | | // console.log(val) |
| | | if (val.length > 0) { |
| | | min = Math.min(...val); |
| | | } |
| | |
| | | fouList.forEach((item) => { |
| | | f = f.replace(new RegExp(item, "g"), ""); |
| | | }); |
| | | // console.log('f',f) |
| | | let arr = f.split(",").filter((item) => { |
| | | return ( |
| | | item && /[a-zA-Z]/.test(item) && item != "undefined" && item != "null" |
| | |
| | | } |
| | | }, |
| | | getUserList(){ |
| | | selectUserCondition({ type: 0 }).then((res) => { |
| | | selectUserCondition({ type: 2 }).then((res) => { |
| | | this.userList = res.data; |
| | | }) |
| | | }, |
| | |
| | | <el-form-item label="å§æäºº" prop="commissionUser"> |
| | | <el-input v-model="entitySearch.commissionUser" clearable placeholder="请è¾å
¥" size="small" |
| | | @keyup.enter.native="refreshTable()"></el-input> |
| | | </el-form-item> |
| | | </el-form-item>li |
| | | <el-form-item> |
| | | <el-button icon="el-icon-refresh" size="mini" @click="refresh">é ç½®</el-button> |
| | | <el-button type="primary" icon="el-icon-search" size="mini" @click="refreshTable">æ¥ è¯¢</el-button> |
| | |
| | | </div> |
| | | <div class="table"> |
| | | <el-table v-loading="tableListLoading" :data="tableList" |
| | | height="630" style="width: 100%" border :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }"> |
| | | <el-table-column align="center" label="åºå·" type="index" width="60"></el-table-column> |
| | | <el-table-column label="è¯æ ·åç§°" prop="sampleName" show-overflow-tooltip width="120"></el-table-column> |
| | | <el-table-column label="å§æç¼å·" prop="entrustCode" show-overflow-tooltip width="120"></el-table-column> |
| | | <el-table-column label="å§ææ¶é´" prop="commissionDate" width="120"></el-table-column> |
| | | <el-table-column label="åå·" prop="modelNo"></el-table-column> |
| | | <el-table-column label="å§æåä½" prop="commissionUnit" show-overflow-tooltip width="120"></el-table-column> |
| | | <el-table-column label="ç产åä½" prop="production" show-overflow-tooltip width="120"></el-table-column> |
| | | height="630" border :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }"> |
| | | <el-table-column align="center" label="åºå·" type="index"></el-table-column> |
| | | <el-table-column label="è¯æ ·åç§°" prop="sampleName" show-overflow-tooltip></el-table-column> |
| | | <el-table-column label="å§æç¼å·" prop="entrustCode" show-overflow-tooltip></el-table-column> |
| | | <el-table-column label="å§ææ¶é´" prop="commissionDate" show-overflow-tooltip></el-table-column> |
| | | <el-table-column label="åå·" prop="modelNo" show-overflow-tooltip></el-table-column> |
| | | <el-table-column label="å§æåä½" prop="commissionUnit" show-overflow-tooltip></el-table-column> |
| | | <el-table-column label="ç产åä½" prop="production" show-overflow-tooltip></el-table-column> |
| | | <el-table-column label="å§æäºº" prop="commissionUser"></el-table-column> |
| | | <el-table-column label="æ ·åæ°é" prop="quantity"></el-table-column> |
| | | <el-table-column label="æ ·åç¶æ" prop="sampleStatus"></el-table-column> |
| | |
| | | <span v-if="scope.row.isLeave === 0">å¦</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="æ ·åå¤çæ¹å¼" prop="processing"> |
| | | <el-table-column label="æ ·åå¤çæ¹å¼" prop="processing" width="150"> |
| | | <template slot-scope="scope"> |
| | | <span v-if="scope.row.processing === 1">å®éªå®¤å¤ç</span> |
| | | <span v-if="scope.row.processing === 0">å§æåä½åå</span> |
| | |
| | | this.$emit('closeCarryOutDia') |
| | | }, |
| | | getAuthorizedPerson() { |
| | | selectUserCondition({ type: 1 }).then((res) => { |
| | | selectUserCondition({ type: 2 }).then((res) => { |
| | | let data = []; |
| | | res.data.forEach((a) => { |
| | | data.push({ |
| | |
| | | }) |
| | | }, |
| | | getAuthorizedPerson() { |
| | | selectUserCondition({ type: 1 }).then((res) => { |
| | | selectUserCondition({ type: 2 }).then((res) => { |
| | | let data = []; |
| | | res.data.forEach((a) => { |
| | | data.push({ |
| | |
| | | this.$emit('closeDia') |
| | | }, |
| | | getUserList(){ |
| | | selectUserCondition({ type: 0 }).then((res) => { |
| | | selectUserCondition({ type: 2 }).then((res) => { |
| | | this.userList = res.data; |
| | | }) |
| | | }, |
| | |
| | | this.$emit('closeProcessingDia') |
| | | }, |
| | | getAuthorizedPerson() { |
| | | selectUserCondition({ type: 1 }).then((res) => { |
| | | selectUserCondition({ type: 2 }).then((res) => { |
| | | let data = []; |
| | | res.data.forEach((a) => { |
| | | data.push({ |
| | |
| | | this.$emit('closeRecordsDia') |
| | | }, |
| | | getAuthorizedPerson() { |
| | | selectUserCondition({ type: 1 }).then((res) => { |
| | | selectUserCondition({ type: 2 }).then((res) => { |
| | | let data = []; |
| | | res.data.forEach((a) => { |
| | | data.push({ |
| | |
| | | this.showStep = step |
| | | }, |
| | | getAuthorizedPerson() { |
| | | selectUserCondition({ type: 1 }).then((res) => { |
| | | selectUserCondition({ type: 2 }).then((res) => { |
| | | let data = []; |
| | | res.data.forEach((a) => { |
| | | data.push({ |
| | |
| | | minWidth: '160' |
| | | }, { |
| | | dataType: 'action', |
| | | minWidth: '170', |
| | | label: 'æä½', |
| | | fixed: 'right', |
| | | operation: [ |
| | |
| | | minWidth: '150px' |
| | | }, { |
| | | dataType: 'action', |
| | | width: '260', |
| | | label: 'æä½', |
| | | fixed: 'right', |
| | | operation: [ |
| | |
| | | this.getUserList() |
| | | }, |
| | | getUserList() { |
| | | selectUserCondition({ type: 0 }).then((res) => { |
| | | selectUserCondition({ type: 2 }).then((res) => { |
| | | this.userList = res.data; |
| | | }) |
| | | }, |
| | |
| | | } |
| | | }, |
| | | getUserList(){ |
| | | selectUserCondition({ type: 0 }).then((res) => { |
| | | selectUserCondition().then((res) => { |
| | | this.userList = res.data; |
| | | }) |
| | | }, |
| | |
| | | </div> |
| | | <div> |
| | | <lims-table :tableData="tableData" :column="column" :page="page" :tableLoading="tableLoading" |
| | | :rowClassName="rowClassName" :height="'calc(100vh - 270px)'" @pagination="pagination" |
| | | key="tableData0"></lims-table> |
| | | :rowClassName="rowClassName" :height="'calc(100vh - 270px)'" @pagination="pagination" |
| | | key="tableData0"></lims-table> |
| | | </div> |
| | | <!--æ¥åæ¥ç--> |
| | | <el-dialog title="æ¥åæ¥ç" :visible.sync="issuedVisible" width="80vw" :modal-append-to-body="false" |
| | |
| | | prop: "type", |
| | | dataType: "tag", |
| | | formatData: (params) => { |
| | | return this.urgencyLevel.find((m) => m.value == params).label; |
| | | if (this.urgencyLevel.find((m) => m.value == params)) { |
| | | return this.urgencyLevel.find((m) => m.value == params).label; |
| | | } else { |
| | | return null |
| | | } |
| | | }, |
| | | formatType: (params) => { |
| | | if (this.urgencyLevel.find((m) => m.value == params)) { |
| | | return this.urgencyLevel.find((m) => m.value == params).type; |
| | | } else { |
| | | return null |
| | | } |
| | | }, |
| | | }, |
| | | { |
| | |
| | | prop: "insState", |
| | | dataType: "tag", |
| | | formatData: (params) => { |
| | | return this.inspectionTaskState.find((m) => m.value == params) |
| | | .label; |
| | | if (this.inspectionTaskState.find((m) => m.value == params)) { |
| | | return this.inspectionTaskState.find((m) => m.value == params).label; |
| | | } else { |
| | | return null |
| | | } |
| | | }, |
| | | formatType: (params) => { |
| | | return this.inspectionTaskState.find((m) => m.value == params).type; |
| | | if (this.inspectionTaskState.find((m) => m.value == params)) { |
| | | return this.inspectionTaskState.find((m) => m.value == params).type; |
| | | } else { |
| | | return null |
| | | } |
| | | }, |
| | | }, |
| | | { label: "æ£éªäºº", prop: "userName" }, |
| | |
| | | fullscreen: false, |
| | | option: null, |
| | | orderTypeList: [ |
| | | { label: 'å§æè¯éª', value: 'Customer-ordered test' }, |
| | | { label: 'æ½æ£', value: 'æ½æ£' }, |
| | | { label: 'è¿åæ£éª', value: 'è¿åæ£éª' }, |
| | | { label: 'å£åº¦æ£éª', value: 'Quarterly inspection' }, |
| | | { label: 'å§æè¯éª', value: 'Customer-ordered test', type: 'success' }, |
| | | { label: 'æ½æ£', value: 'æ½æ£', type: 'danger' }, |
| | | { label: 'è¿åæ£éª', value: 'è¿åæ£éª', type: 'info' }, |
| | | { label: 'å£åº¦æ£éª', value: 'Quarterly inspection', type: '' }, |
| | | ], |
| | | urgencyLevel: [], |
| | | inspectionTaskState: [], |
| | |
| | | } |
| | | return ""; |
| | | }, |
| | | // æ¥ç产ä¸é¾ä¿¡æ¯ |
| | | // openInfoDialog (row) { |
| | | // this.showInfoDialog = true |
| | | // this.$nextTick(() => { |
| | | // this.$refs.showInfoDialog.getInfo(row.ifsInventoryId) |
| | | // }) |
| | | // }, |
| | | selectAllByOne(row) { |
| | | this.isCopper = row.isCopper |
| | | this.customsInspection = row |
| | |
| | | // æ¥çæ¥å |
| | | handleIssued(row) { |
| | | // todo: æ¥çæ¥åç»ä»¶ |
| | | /* if (!row.tempUrlPdf) return this.$message.warning('æä»¶æªä¸ä¼ ') |
| | | this.currentInfo = row |
| | | this.lookDialogVisible = true*/ |
| | | console.log(this.javaApi) |
| | | this.currentInfo = row; |
| | | let fileName = row.url |
| | | let fileType = "docx" |
| | |
| | | } |
| | | }, |
| | | getAuthorizedPerson() { |
| | | selectUserCondition({ type: 0 }).then((res) => { |
| | | selectUserCondition({ type: 1 }).then((res) => { |
| | | let data = []; |
| | | res.data.forEach((a) => { |
| | | data.push({ |
| | |
| | | </div> |
| | | <lims-table :tableData="tableData" :column="column" :page="page" :tableLoading="tableLoading" |
| | | :rowClassName="rowClassName" :height="'calc(100vh - 300px)'" @pagination="pagination" |
| | | key="tableData0"></lims-table> |
| | | key="tableData0"> |
| | | <div slot="action" slot-scope="scope"> |
| | | <el-button size="small" type="text" @click="handleDataLook(scope.row)">æ°æ®æ¥ç</el-button> |
| | | <el-button type="text" size="small" |
| | | :disabled="(scope.row.userName == null || scope.row.insState == 3 || scope.row.insState == 5) && checkPermi(['update:product:onPlan'])" |
| | | @click="editInspection(scope.row)">ä¿®æ¹æ£éªå¼</el-button> |
| | | <el-button type="text" size="small" :disabled="( |
| | | scope.row.userName == null || |
| | | scope.row.insState == 3 || |
| | | scope.row.insState == 5 || |
| | | (scope.row.userName && !scope.row.userName.includes(nickName)) |
| | | )" |
| | | @click="handleInspection(scope.row)">æ£éª</el-button> |
| | | <el-button type="text" size="small" :disabled="( |
| | | scope.row.userName == null || |
| | | scope.row.insState == 5 || |
| | | scope.row.insState == 3 || |
| | | (scope.row.userName && !scope.row.userName.includes(nickName)) |
| | | )" |
| | | @click="handleConnect(scope.row)">交æ¥</el-button> |
| | | <el-button type="text" size="small" @click="viewInspectInfo(scope.row)">åå§è®°å½</el-button> |
| | | <el-popover placement="bottom" trigger="hover" style="margin-left: 6px"> |
| | | <template #reference> |
| | | <el-button link type="text" size="small">æ´å¤</el-button> |
| | | </template> |
| | | <div> |
| | | <el-button :disabled="scope.row.insState != 3" style="margin-left: 10px" type="text" size="small" @click="download(scope.row)">ä¸è½½æ¥å</el-button> |
| | | <el-upload ref='upload' |
| | | :action="javaApi + '/insReport/inReport'" |
| | | :before-upload="beforeUpload" |
| | | :data="{id: scope.row.insReportId}" |
| | | :headers="uploadHeader" :on-error="onError" |
| | | :on-success="handleSuccessUp" |
| | | :show-file-list="false" |
| | | style="display: inline;margin: 0 6px" |
| | | accept='.jpg,.jpeg,.png,.gif,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip,.rar'> |
| | | <el-button :disabled="scope.row.insState != 3" size="small" type="text">ä¸ä¼ </el-button> |
| | | </el-upload> |
| | | <el-button :disabled="scope.row.insState != 3" type="text" size="small" @click="handleRestore(scope.row)">è¿å</el-button> |
| | | <el-button :disabled="scope.row.insState != 3" type="text" size="small" @click="handleIssued(scope.row)">æ¥çæ¥å</el-button> |
| | | </div> |
| | | </el-popover> |
| | | </div> |
| | | </lims-table> |
| | | </div> |
| | | </div> |
| | | <el-dialog :visible.sync="claimVisible" title="æç¤º" width="400px"> |
| | |
| | | </span> |
| | | </el-dialog> |
| | | <el-dialog :visible.sync="dataDialogVisible" title="æ°æ®æ¥ç" width="80%"> |
| | | <div v-if="dataDialogVisible" style="height: 70vh; overflow-y: auto"> |
| | | <div v-if="dataDialogVisible" style="height: 74vh; overflow-y: auto"> |
| | | <div> |
| | | <el-form :model="entity" :inline="true"> |
| | | <el-form-item label="æ£éªé¡¹" prop="outputWorkTime"> |
| | |
| | | } from "@/api/business/inspectionTask.js"; |
| | | import { mapGetters } from "vuex"; |
| | | import {getRetestResult} from "@/api/business/rawMaterialOrder"; |
| | | import {upReportUrl} from "@/api/business/insReport"; |
| | | export default { |
| | | name: 'InspectionTask', |
| | | components: { |
| | |
| | | { label: "æ£éªå¼å§æ¶é´", prop: "insTime", width: "140px" }, |
| | | { label: "çç±", prop: "verifyTell", width: "140px" }, |
| | | { |
| | | dataType: "action", |
| | | fixed: "right", |
| | | label: "æä½", |
| | | operation: [ |
| | | { |
| | | name: "æ°æ®æ¥ç", |
| | | type: "text", |
| | | clickFun: (row) => { |
| | | this.handleDataLook(row); |
| | | }, |
| | | }, |
| | | { |
| | | name: "ä¿®æ¹æ£éªå¼", |
| | | type: "text", |
| | | clickFun: (row) => { |
| | | this.editInspection(row); |
| | | }, |
| | | disabled: (row) => { |
| | | return (row.userName == null || row.insState == 3 || row.insState == 5) && this.checkPermi(['update:product:onPlan']) |
| | | }, |
| | | }, |
| | | { |
| | | name: "æ¥çå·¥æ¶", |
| | | type: "text", |
| | | clickFun: (row) => { |
| | | this.viewManHour(row); |
| | | }, |
| | | showHide: (row) => { |
| | | return this.checkPermi(['get:working:hours:byOrder']) |
| | | }, |
| | | }, |
| | | { |
| | | name: "æ£éª", |
| | | type: "text", |
| | | clickFun: (row) => { |
| | | this.handleInspection(row); |
| | | }, |
| | | disabled: (row) => { |
| | | return ( |
| | | row.userName == null || |
| | | row.insState == 3 || |
| | | row.insState == 5 || |
| | | (row.userName && !row.userName.includes(this.nickName)) |
| | | ); |
| | | }, |
| | | }, |
| | | { |
| | | name: "交æ¥", |
| | | type: "text", |
| | | clickFun: (row) => { |
| | | this.handleConnect(row); |
| | | }, |
| | | disabled: (row) => { |
| | | return ( |
| | | row.userName == null || |
| | | row.insState == 5 || |
| | | row.insState == 3 || |
| | | (row.userName && !row.userName.includes(this.nickName)) |
| | | ); |
| | | }, |
| | | }, |
| | | { |
| | | name: "åå§è®°å½", |
| | | type: "text", |
| | | clickFun: (row) => { |
| | | this.viewInspectInfo(row); |
| | | }, |
| | | }, |
| | | ], |
| | | }, |
| | | dataType: "slot", |
| | | slot: "action", |
| | | width: '340px', |
| | | label: "æä½" |
| | | } |
| | | ], |
| | | page: { |
| | | total: 0, |
| | | size: 10, |
| | | size: 20, |
| | | current: 0, |
| | | }, |
| | | tableLoading: false, |
| | |
| | | ], |
| | | lookPage: { |
| | | total: 0, |
| | | size: 10, |
| | | size: 20, |
| | | current: 0, |
| | | }, |
| | | lookTableLoading: false, |
| | |
| | | this.page.current = 1; |
| | | this.queryParams.typeSource = this.tabIndex; |
| | | this.getList(); |
| | | }, |
| | | // ä¸è½½æ¥å |
| | | download(row) { |
| | | let url = (row.urlS===null||row.urlS==='')?row.url:row.urlS |
| | | const link = document.createElement('a'); |
| | | link.href = this.javaApi + url; |
| | | link.target = '_blank'; |
| | | document.body.appendChild(link); |
| | | link.click(); |
| | | }, |
| | | // è¿åæä½ |
| | | handleRestore(row) { |
| | | this.$confirm('æ¯å¦è¿åå½åæ¥å?', "è¦å", { |
| | | confirmButtonText: "ç¡®å®", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning" |
| | | }).then(() => { |
| | | upReportUrl({ id: row.insReportId }).then(res => { |
| | | if (res.code === 200) { |
| | | this.$message.success('è¿åæå') |
| | | this.refreshTable() |
| | | } |
| | | }) |
| | | }).catch(() => { }) |
| | | |
| | | }, |
| | | // æ¥çæ¥å |
| | | handleIssued(row) { |
| | | // todo: æ¥çæ¥åç»ä»¶ |
| | | this.currentInfo = row; |
| | | let fileName = row.url |
| | | let fileType = "docx" |
| | | if (row.tempUrlPdf != null || row.tempUrlPdf === '') { |
| | | fileName = row.tempUrlPdf |
| | | fileType = "pdf" |
| | | } |
| | | fileName = fileName.replace('/word/','') |
| | | const userName = this.nickName |
| | | this.option = { |
| | | url: this.javaApi + "/word/" + fileName, |
| | | isEdit: false, |
| | | fileType: fileType, |
| | | title: fileName, |
| | | lang: 'zh-CN', |
| | | isPrint: false, |
| | | user_id: 1, |
| | | user_name: userName, |
| | | editUrl: this.javaApi + "/insReport/onlyOffice/save?fileName=" + fileName |
| | | } |
| | | this.issuedVisible = true; |
| | | }, |
| | | // æ¥ç产ä¸é¾ä¿¡æ¯ |
| | | openInfoDialog(row) { |
| | |
| | | this.bindCurrentInfo = row; |
| | | getBindingProductByProductId({ productId: row.insProductId }) |
| | | .then((res) => { |
| | | // console.log(res) |
| | | this.bindTableData = res.data; |
| | | this.bindDialogVisible = true; |
| | | }) |
| | |
| | | productId: this.bindCurrentInfo.insProductId, |
| | | }) |
| | | .then((res) => { |
| | | // console.log(res) |
| | | this.bindAddTableData = res.data; |
| | | this.bindAddDialogVisible = true; |
| | | }) |
| | |
| | | }); |
| | | }); |
| | | }, |
| | | beforeUpload (file) { |
| | | if (file.size > 1024 * 1024 * 10) { |
| | | this.$message.error('ä¸ä¼ æä»¶ä¸è¶
è¿10M'); |
| | | this.$refs.upload.clearFiles() |
| | | return false; |
| | | } else { |
| | | return true; |
| | | } |
| | | }, |
| | | onError(error, file, fileList, index) { |
| | | this.$message.error('æä»¶ä¸ä¼ 失败ï¼è¯·éè¯'); |
| | | }, |
| | | onExceed() { |
| | | this.$message.warning("è¶
åºæä»¶ä¸ªæ°"); |
| | | }, |
| | | handleSuccessUp(response) { |
| | | if (response.code == 200) { |
| | | this.$refs.upload.clearFiles() |
| | | this.$message.success("ä¸ä¼ æå"); |
| | | } else { |
| | | this.$message.error(response.message); |
| | | } |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |
| | |
| | | delfile, |
| | | inspectionOrderDetailsTaskSwitching |
| | | } from "@/api/business/inspectionTask.js"; |
| | | import InspectionWorker from '../../../InspectionWorker.worker'; |
| | | import DataWorker from '../../../DataWorker.worker'; |
| | | import InspectionWorker from '../../../workers/InspectionWorker.worker'; |
| | | import DataWorker from '../../../workers/DataWorker.worker'; |
| | | import html2canvas from "html2canvas"; |
| | | import { mapGetters } from "vuex"; |
| | | import viewManHourDia from "@/views/business/inspectionTask/components/viewManHourDia.vue"; |
| | |
| | | this.dataAcquisitionInfo = {}; |
| | | this.getData = []; |
| | | for (let i in this.objectOrder(data)) { |
| | | console.log("i---", i); |
| | | let obj = {}; |
| | | if (i.includes("@")) { |
| | | obj = { |
| | |
| | | }, |
| | | // ä¿åæ¹¿åº¦ãæ¸©åº¦æ°æ® |
| | | subOtherForm(m, type) { |
| | | console.log("m---", m); |
| | | write({ |
| | | [type]: type === "remark" ? m : Number(m), |
| | | id: this.insOrder.id, |
| | |
| | | } |
| | | }, |
| | | getAuthorizedPerson() { |
| | | selectUserCondition({ type: 0 }).then((res) => { |
| | | selectUserCondition({ type: 1 }).then((res) => { |
| | | let data = []; |
| | | res.data.forEach((a) => { |
| | | data.push({ |
| | |
| | | justify-content: space-between; |
| | | margin-bottom: 10px; |
| | | } |
| | | >>>.warning-row { |
| | | color: #1890FF; |
| | | } |
| | | .node_i { |
| | | color: orange; |
| | | font-size: 18px; |
| | | } |
| | | </style> |
| | |
| | | <div> |
| | | <span>éè´è®¢åä¿¡æ¯</span> |
| | | <ul class="tab" v-if="active > 1 && isShowTab"> |
| | | <li v-for="(m, i) in dataTitle" :key="i" :class="{ active: i === dataIndex }" @click="handleDataTab(m, i)"> |
| | | {{ m.label }}</li> |
| | | <li v-for="(m,i) in dataTitle" :key="i" :class="{active:i===dataIndex}" @click="handleDataTab(m,i)">{{m.label}}</li> |
| | | </ul> |
| | | </div> |
| | | <div> |
| | | <el-select v-show="active == 1" v-model="template" placeholder="ä¸å模æ¿" size="small" style="margin-right: 10px;" |
| | | @change="selectInsOrderTemplateByIdList"> |
| | | <el-select v-show="active==1" v-model="template" placeholder="ä¸å模æ¿" size="small" style="margin-right: 10px;" |
| | | @change="selectInsOrderTemplateByIdList"> |
| | | <el-option v-for="(a, ai) in templates" :key="ai" :label="a.name" :value="a.id"> |
| | | <span style="float: left">{{ a.name }}</span> |
| | | <i class="el-icon-delete" style="float: right; color: #66b1ff; font-size: 16px" |
| | | @click.stop="handleDelete(a)"></i> |
| | | @click.stop="handleDelete(a)"></i> |
| | | </el-option> |
| | | </el-select> |
| | | <el-button v-show="active == 1" size="small" @click="templateDia = true"> |
| | | <el-button v-show="active==1" size="small" @click="templateDia=true"> |
| | | <span style="color: #3A7BFA;">ä¿å模æ¿</span> |
| | | </el-button> |
| | | <el-button v-show="active == 1 && addObj.orderType === 'è¿åæ£éª'" :loading="noNeedCheckLoad" size="small" |
| | | type="primary" @click="noNeedCheck">å
æ£</el-button> |
| | | <el-button v-show="active == 1" :loading="saveLoad" size="small" type="primary" @click="save">æäº¤</el-button> |
| | | <el-button v-show="active==1 && addObj.orderType === 'è¿åæ£éª'" :loading="noNeedCheckLoad" size="small" type="primary" @click="noNeedCheck">å
æ£</el-button> |
| | | <el-button v-show="active==1" :loading="saveLoad" size="small" type="primary" @click="save">æäº¤</el-button> |
| | | <el-button size="small" @click="goBack"> |
| | | <span style="color: #3A7BFA;">è¿å</span> |
| | | </el-button> |
| | |
| | | <el-row> |
| | | <el-col :span="6"> |
| | | <el-form-item class="addObj-form-item" label="éè´è®¢åå·:"> |
| | | <el-input v-model="addObj.orderNo" class="addObj-info" clearable disabled placeholder="" |
| | | size="small"></el-input> |
| | | <el-input v-model="addObj.orderNo" class="addObj-info" clearable disabled placeholder="" size="small"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-form-item class="addObj-form-item" label="å§æåä½:"> |
| | | <el-input v-model="addObj.company" class="addObj-info" clearable disabled placeholder="" |
| | | size="small"></el-input> |
| | | <el-input v-model="addObj.company" class="addObj-info" clearable disabled placeholder="" size="small"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-form-item class="addObj-form-item" label="æ¥æ¶æ¶é´:"> |
| | | <el-date-picker v-model="addObj.receiverDate" disabled placeholder="éæ©æ¥æ" size="small" |
| | | style="width: 100%;" type="date" value-format="yyyy-MM-dd"> |
| | | <el-date-picker |
| | | v-model="addObj.receiverDate" |
| | | disabled |
| | | placeholder="éæ©æ¥æ" |
| | | size="small" |
| | | style="width: 100%;" |
| | | type="date" |
| | | value-format="yyyy-MM-dd"> |
| | | </el-date-picker> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-form-item class="addObj-form-item" label="é¶ä»¶å·:"> |
| | | <el-input v-model="addObj.partNo" class="addObj-info" clearable disabled placeholder="" |
| | | size="small"></el-input> |
| | | <el-input v-model="addObj.partNo" class="addObj-info" clearable disabled placeholder="" size="small"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="6"> |
| | | <el-form-item class="addObj-form-item" label="æ ·ååç§°:"> |
| | | <el-input v-model="addObj.sample" class="addObj-info" clearable disabled placeholder="" |
| | | size="small"></el-input> |
| | | <el-input v-model="addObj.sample" class="addObj-info" clearable disabled placeholder="" size="small"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-form-item class="addObj-form-item" label="æ ·åæ»æ°:"> |
| | | <el-input v-model="addObj.qtyArrived" class="addObj-info" clearable disabled placeholder="" |
| | | size="small"></el-input> |
| | | <el-input v-model="addObj.qtyArrived" class="addObj-info" clearable disabled placeholder="" size="small"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-form-item class="addObj-form-item" label="æ½æ£æ°é:" prop="testQuantity"> |
| | | <el-input v-model="addObj.testQuantity" :disabled="active > 1" class="addObj-info" clearable |
| | | placeholder="è¯·å¡«åæ½æ£æ°é" size="small"></el-input> |
| | | <el-input v-model="addObj.testQuantity" :disabled="active > 1" class="addObj-info" |
| | | clearable |
| | | placeholder="è¯·å¡«åæ½æ£æ°é" size="small"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-form-item class="addObj-form-item" label="æ£éªç±»å«:" prop="orderType"> |
| | | <el-select v-model="addObj.orderType" :disabled="active > 1 || orderType == 1" clearable size="small" |
| | | style="width: 100%"> |
| | | <el-option v-for="a in dict.type.check_type" :key="a.value" :label="a.label" |
| | | :value="a.value"></el-option> |
| | | <el-select v-model="addObj.orderType" :disabled="active>1 || orderType==1" clearable size="small" style="width: 100%"> |
| | | <el-option v-for="a in dict.type.check_type" :key="a.value" :label="a.label" :value="a.value"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-form-item class="addObj-form-item" label="è§æ ¼åå·:" placeholder="请填å" prop="partDetail"> |
| | | <el-tooltip :content="addObj.partDetail" :disabled="!addObj.partDetail"> |
| | | <el-input v-model="addObj.partDetail" :disabled="active > 1" clearable class="addObj-info" |
| | | size="small"></el-input> |
| | | <el-input v-model="addObj.partDetail" :disabled="active > 1" clearable class="addObj-info" size="small"></el-input> |
| | | </el-tooltip> |
| | | </el-form-item> |
| | | </el-col> |
| | |
| | | <el-row> |
| | | <el-col :span="6"> |
| | | <el-form-item class="addObj-form-item" label="ç´§æ¥ç¨åº¦:" placeholder="è¯·éæ©" prop="type"> |
| | | <el-select v-model="addObj.type" :disabled="active > 1" class="addObj-info" clearable size="small" |
| | | style="width: 100%"> |
| | | <el-option v-for="a in dict.type.urgency_level" :key="a.value" :label="a.label" |
| | | :value="a.value"></el-option> |
| | | <el-select v-model="addObj.type" :disabled="active>1" class="addObj-info" clearable size="small" style="width: 100%"> |
| | | <el-option v-for="a in dict.type.urgency_level" :key="a.value" :label="a.label" :value="a.value"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-form-item class="addObj-form-item" label="çº¦å®æ¶é´:" prop="appointed"> |
| | | <el-date-picker v-model="addObj.appointed" :disabled="active > 1" format="yyyy-MM-dd" placeholder="éæ©æ¥æ" |
| | | size="small" style="width: 100%" type="date" value-format="yyyy-MM-dd"> |
| | | <el-date-picker |
| | | v-model="addObj.appointed" |
| | | :disabled="active > 1" |
| | | format="yyyy-MM-dd" |
| | | placeholder="éæ©æ¥æ" |
| | | size="small" |
| | | style="width: 100%" |
| | | type="date" |
| | | value-format="yyyy-MM-dd"> |
| | | </el-date-picker> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-form-item class="addObj-form-item" label="夿³¨:"> |
| | | <el-input v-model="addObj.remark" :autosize="{ minRows: 2, maxRows: 2 }" :disabled="active > 1" |
| | | :placeholder="active > 1 ? '' : '请è¾å
¥'" clearable size="small" type="textarea"></el-input> |
| | | <el-input v-model="addObj.remark" :autosize="{ minRows: 2, maxRows: 2}" :disabled="active>1" :placeholder="active>1 ? '' : '请è¾å
¥'" clearable |
| | | size="small" type="textarea"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | </div> |
| | | <div> |
| | | <div style="display: flex;justify-content: space-between;background-color: #F5F7FB;margin-bottom: 6px"> |
| | | <div v-if="active == 1"> |
| | | <div v-if="active==1"> |
| | | <el-form :inline="true" :model="addObj1" label-width="90px"> |
| | | <el-form-item label="æ ·ååå·:" style="margin-bottom: 6px;margin-top: 6px"> |
| | | <el-select v-model="model" :placeholder="active > 1 ? '' : '请è¾å
¥'" allow-create clearable |
| | | default-first-option filterable size="small" @change="changeModel"> |
| | | <el-select v-model="model" :placeholder="active>1 ? '' : '请è¾å
¥'" |
| | | allow-create clearable default-first-option filterable |
| | | size="small" |
| | | @change="changeModel"> |
| | | <el-option v-for="item in models" :key="item.value" :label="item.label" :value="item.value"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="æ£éªæ å:" style="margin-bottom: 6px;margin-top: 6px"> |
| | | <el-select v-model="standardMethodListId" :loading="methodLoad" :placeholder="active > 1 ? '' : '请è¾å
¥'" |
| | | clearable size="small" @change="changeStandardMethodListId" @focus="methodFocus"> |
| | | <el-select v-model="standardMethodListId" :loading="methodLoad" |
| | | :placeholder="active>1 ? '' : '请è¾å
¥'" clearable size="small" |
| | | @change="changeStandardMethodListId" @focus="methodFocus"> |
| | | <el-option v-for="item in methods" :key="item.id" :label="item.code" :value="item.id"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="" style="margin-bottom: 6px;margin-top: 6px"> |
| | | <el-button type="primary" size="small">车é´éä»¶æ¥ç</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <div style="margin-bottom: 6px;margin-top: 6px"> |
| | | <el-button v-show="active == 1" :disabled="sampleList.length === 2" size="small" type="primary" |
| | | @click="handleSplitCountNum">æå</el-button> |
| | | <el-button v-show="active==1" :disabled="sampleList.length === 2" size="small" type="primary" @click="handleSplitCountNum">æå</el-button> |
| | | </div> |
| | | </div> |
| | | |
| | | <el-table ref="sampleTable" :data="sampleList" class="el-table sampleTable" highlight-current-row |
| | | :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }" border max-height="400px" tooltip-effect="dark" |
| | | @selection-change="selectSample" @row-click="rowClick"> |
| | | <el-table-column v-if="active == 1" :selectable="selectable" type="selection" width="65"></el-table-column> |
| | | <el-table ref="sampleTable" :data="sampleList" |
| | | class="el-table sampleTable" |
| | | highlight-current-row |
| | | :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }" border |
| | | max-height="400px" |
| | | tooltip-effect="dark" |
| | | @selection-change="selectSample" @row-click="rowClick"> |
| | | <el-table-column v-if="active==1" :selectable="selectable" type="selection" width="65"></el-table-column> |
| | | <el-table-column align="center" label="åºå·" prop="index" type="index" width="65"></el-table-column> |
| | | <el-table-column align="center" label="æ ·ååç§°" min-width="100" prop="sample"> |
| | | <template slot-scope="scope"> |
| | | <el-input v-model="scope.row.sample" :disabled="active > 1 || scope.$index !== 0" size="small" |
| | | @change="(val) => changeValue(val, 'sample')"></el-input> |
| | | <el-input v-model="scope.row.sample" :disabled="active>1 || scope.$index !== 0" size="small" @change="(val)=>changeValue(val, 'sample')"></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column align="center" label="æ ·åç¼å·" min-width="140" prop="sampleCode"> |
| | | <template slot-scope="scope"> |
| | | <el-input v-model="scope.row.sampleCode" :disabled="active > 1 || scope.$index !== 0" clearable |
| | | placeholder="ä¸å¡«ååç³»ç»èªå¨çæ" size="small" @change="(val) => changeValue(val, 'sampleCode')"></el-input> |
| | | <el-input v-model="scope.row.sampleCode" :disabled="active>1 || scope.$index !== 0" clearable placeholder="ä¸å¡«ååç³»ç»èªå¨çæ" |
| | | size="small" |
| | | @change="(val)=>changeValue(val, 'sampleCode')"></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column align="center" label="æ ·ååå·" min-width="100" prop="model"> |
| | | <template slot-scope="scope"> |
| | | <el-select v-model="scope.row.model" :disabled="active > 1 || scope.$index !== 0" allow-create |
| | | default-first-option filterable placeholder="æ ·ååå·" size="small" style="width: 100%;" |
| | | @change="handleChangeModel"> |
| | | <el-select v-model="scope.row.model" :disabled="active>1 || scope.$index !== 0" allow-create default-first-option filterable |
| | | placeholder="æ ·ååå·" size="small" style="width: 100%;" @change="handleChangeModel"> |
| | | <el-option v-for="item in models" :key="item.value" :label="item.label" :value="item.value"> |
| | | </el-option> |
| | | </el-select> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column v-if="!(active > 1)" align="center" label="åå·åæ°" prop="modelNum" width="130"> |
| | | <el-table-column v-if="!(active>1)" align="center" label="åå·åæ°" prop="modelNum" width="130"> |
| | | <template slot-scope="scope"> |
| | | <el-input v-model="scope.row.modelNum" :disabled="active > 1 || scope.$index !== 0" clearable |
| | | placeholder="éå¿
å¡«" size="small" |
| | | @input="methodChange(scope.row.standardMethodListId, scope.row)"></el-input> |
| | | <el-input v-model="scope.row.modelNum" :disabled="active>1|| scope.$index !== 0" clearable placeholder="éå¿
å¡«" |
| | | size="small" |
| | | @input="methodChange(scope.row.standardMethodListId, scope.row)"></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column align="center" label="æ£éªæ å" min-width="100" prop="standardMethodListId"> |
| | | <template slot-scope="scope"> |
| | | <el-select v-model="scope.row.standardMethodListId" |
| | | :disabled="scope.row.model == null || active > 1 || scope.$index !== 0" :loading="methodLoad" clearable |
| | | placeholder="æ£éªæ å" size="small" style="width: 100%;" @change="(value) => methodChange(value, scope.row)" |
| | | @clear="productList = []" @focus="methodFocus"> |
| | | <el-select v-model="scope.row.standardMethodListId" :disabled="scope.row.model==null||active>1|| scope.$index !== 0" |
| | | :loading="methodLoad" clearable placeholder="æ£éªæ å" size="small" |
| | | style="width: 100%;" @change="(value)=>methodChange(value, scope.row)" @clear="productList = []" @focus="methodFocus"> |
| | | <el-option v-for="item in methods" :key="item.id" :label="item.code" :value="item.id"> |
| | | </el-option> |
| | | </el-select> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column v-if="addObj.mating == 1" align="center" label="é
奿 ·ååç§°" prop="joinName" width="140"> |
| | | <el-table-column v-if="addObj.mating==1" align="center" label="é
奿 ·ååç§°" prop="joinName" width="140"> |
| | | <template slot-scope="scope"> |
| | | <el-input v-model="scope.row.joinName" :autosize="{ minRows: 1, maxRows: 1 }" size="small" |
| | | type="textarea"></el-input> |
| | | <el-input v-model="scope.row.joinName" :autosize="{ minRows: 1, maxRows: 1}" size="small" |
| | | type="textarea"></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column v-if="addObj.mating == 1" align="center" label="é
奿 ·ååå·" prop="joinModel" width="140"> |
| | | <el-table-column v-if="addObj.mating==1" align="center" label="é
奿 ·ååå·" prop="joinModel" width="140"> |
| | | <template slot-scope="scope"> |
| | | <el-input v-model="scope.row.joinModel" :autosize="{ minRows: 1, maxRows: 1 }" size="small" |
| | | type="textarea"></el-input> |
| | | <el-input v-model="scope.row.joinModel" :autosize="{ minRows: 1, maxRows: 1}" size="small" |
| | | type="textarea"></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column v-if="addObj.mating == 1" align="center" label="é
奿 ·åæ°é" prop="joinNum" width="140"> |
| | | <el-table-column v-if="addObj.mating==1" align="center" label="é
奿 ·åæ°é" prop="joinNum" width="140"> |
| | | <template slot-scope="scope"> |
| | | <el-input-number v-model="scope.row.joinNum" :controls="false" :max="100" :min="1" :precision="0" |
| | | size="small" style="width: 80%;"></el-input-number> |
| | | size="small" style="width: 80%;"></el-input-number> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column align="center" label="å¾
æ£é¡¹æ°é" prop="quantity" width="105"> |
| | | <template slot-scope="scope"> |
| | | <el-select v-model="scope.row.quantity" disabled clearable size="small"> |
| | | <el-option v-for="item in quantityList" :key="item.value" :label="item.label" |
| | | :value="item.value"></el-option> |
| | | <el-select v-model="scope.row.quantity" disabled clearable |
| | | size="small"> |
| | | <el-option v-for="item in quantityList" :key="item.value" :label="item.label" :value="item.value"></el-option> |
| | | </el-select> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <el-table ref="productTable" v-loading="getProductLoad" :data="productList" :row-class-name="tableRowClassName" |
| | | class="el-table" max-height="400px" style="margin-bottom: 10px;" |
| | | :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }" border tooltip-effect="dark" |
| | | @select="selectOne" @selection-change="selectProduct" @select-all="handleAll"> |
| | | <el-table-column v-if="active == 1" :selectable="selectable" type="selection" width="65"></el-table-column> |
| | | <el-table ref="productTable" v-loading="getProductLoad" :data="productList" |
| | | :row-class-name="tableRowClassName" |
| | | class="el-table" |
| | | max-height="400px" |
| | | style="margin-bottom: 10px;" |
| | | :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }" border |
| | | tooltip-effect="dark" |
| | | @select="selectOne" |
| | | @selection-change="selectProduct" |
| | | @select-all="handleAll"> |
| | | <el-table-column v-if="active==1" :selectable="selectable" type="selection" width="65"></el-table-column> |
| | | <el-table-column label="æ£éªé¡¹" min-width="140" prop="inspectionItem" show-overflow-tooltip> |
| | | <template slot="header" slot-scope="scope"> |
| | | <div style="display: flex;align-items: center;flex-direction: column;font-size: 14px"> |
| | | <span>æ£éªé¡¹</span> |
| | | <el-input v-if="active == 1" v-model="inspectionItem" placeholder="请è¾å
¥" size="mini" |
| | | @input="searchFilterList" /> |
| | | <el-input |
| | | v-if="active==1" |
| | | v-model="inspectionItem" |
| | | placeholder="请è¾å
¥" |
| | | size="mini" |
| | | @input="searchFilterList"/> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="æ£éªé¡¹å项" min-width="140" prop="inspectionItemSubclass" show-overflow-tooltip> |
| | | <el-table-column label="æ£éªé¡¹å项" min-width="140" prop="inspectionItemSubclass" |
| | | show-overflow-tooltip> |
| | | <template slot="header" slot-scope="scope"> |
| | | <div style="display: flex;align-items: center;flex-direction: column;font-size: 14px"> |
| | | <span>æ£éªé¡¹å项</span> |
| | | <el-input v-if="active == 1" v-model="inspectionItemSubclass" placeholder="请è¾å
¥" size="mini" |
| | | @input="searchFilterList" /> |
| | | <el-input |
| | | v-if="active==1" |
| | | v-model="inspectionItemSubclass" |
| | | placeholder="请è¾å
¥" |
| | | size="mini" |
| | | @input="searchFilterList"/> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="è¦æ±å¼" min-width="220px" prop="ask"> |
| | | <template slot-scope="scope"> |
| | | <el-input v-if="active == 1 && isAskOnlyRead" v-model="scope.row.ask" :autosize="{ minRows: 1, maxRows: 3 }" |
| | | clearable placeholder="è¦æ±å¼" size="small" type="textarea" |
| | | @change="e => requestChange(e, scope.row)"></el-input> |
| | | <el-input v-if="active==1&&isAskOnlyRead" v-model="scope.row.ask" :autosize="{ minRows: 1, maxRows: 3}" clearable placeholder="è¦æ±å¼" |
| | | size="small" type="textarea" |
| | | @change="e=>requestChange(e,scope.row)"></el-input> |
| | | <span v-else> |
| | | <template>{{ scope.row.ask }}</template> |
| | | <template >{{ scope.row.ask }}</template> |
| | | </span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="è¦æ±æè¿°" min-width="220px" prop="tell"> |
| | | <template slot-scope="scope"> |
| | | <el-input v-if="active == 1 && isAskOnlyRead" v-model="scope.row.tell" |
| | | :autosize="{ minRows: 1, maxRows: 3 }" clearable placeholder="è¦æ±æè¿°" size="small" type="textarea" |
| | | @change="e => requestChange(e, scope.row, 'tell')"></el-input> |
| | | <el-input v-if="active==1&&isAskOnlyRead" v-model="scope.row.tell" :autosize="{ minRows: 1, maxRows: 3}" clearable placeholder="è¦æ±æè¿°" |
| | | size="small" type="textarea" |
| | | @change="e=>requestChange(e,scope.row,'tell')"></el-input> |
| | | <span v-else> |
| | | <template>{{ scope.row.tell }}</template> |
| | | </span> |
| | | <template >{{ scope.row.tell }}</template> |
| | | </span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="æ¡ä»¶" min-width="140" prop="radius" show-overflow-tooltip></el-table-column> |
| | |
| | | <template slot="header" slot-scope="scope"> |
| | | <div style="display: flex;align-items: center;flex-direction: column;font-size: 14px"> |
| | | <span>è¯éªæ¹æ³</span> |
| | | <el-input v-if="active == 1" v-model="methodS" placeholder="请è¾å
¥" size="mini" @input="searchFilterList" /> |
| | | <el-input |
| | | v-if="active==1" |
| | | v-model="methodS" |
| | | placeholder="请è¾å
¥" |
| | | size="mini" |
| | | @input="searchFilterList"/> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="计éåä½" prop="unit" show-overflow-tooltip width="100"></el-table-column> |
| | | <el-table-column label="åä»·" prop="price" show-overflow-tooltip width="100"></el-table-column> |
| | | <el-table-column label="åºé´" min-width="120" prop="section" show-overflow-tooltip></el-table-column> |
| | | <el-table-column :filter-method="filterHandler" :filters="filters" label="åå®éªå®¤" min-width="130" |
| | | prop="sonLaboratory" show-overflow-tooltip></el-table-column> |
| | | <el-table-column :filter-method="filterHandler" :filters="filters" label="åå®éªå®¤" min-width="130" prop="sonLaboratory" |
| | | show-overflow-tooltip></el-table-column> |
| | | </el-table> |
| | | </div> |
| | | <!--ç¹æ®å¼å¤çæ¡--> |
| | | <el-dialog :before-close="beforeClose" :close-on-click-modal="false" :close-on-press-escape="false" |
| | | :show-close="false" :visible.sync="bsm1DiaAll" min-width="400px" title="æ£æµå°ç¹æ®é¡¹ï¼è¯·ä½åºä»¥ä¸éæ©"> |
| | | <el-dialog :before-close="beforeClose" :close-on-click-modal="false" :close-on-press-escape="false" :show-close="false" |
| | | :visible.sync="bsm1DiaAll" |
| | | min-width="400px" |
| | | title="æ£æµå°ç¹æ®é¡¹ï¼è¯·ä½åºä»¥ä¸éæ©"> |
| | | <div v-for="(item, index) in bsm1DiaList" :key="item.id" class="body" style="max-height: 60vh;"> |
| | | <span>{{ item.inspectionItem }}</span> |
| | | <span>{{item.inspectionItem}}</span> |
| | | <el-row v-if="item.bsm1"> |
| | | <el-col :span="24" class="search_thing" style="height: initial;margin: 5px 0;"> |
| | | <div class="search_label" style="width: 80px;"><span class="required-span">* </span>é项ï¼</div> |
| | | <div class="search_input"> |
| | | <el-radio-group v-model="item.bsm1Val" v-removeAriaHidden @input="upBsmAll(item)"> |
| | | <el-radio v-for="(a, ai) in JSON.parse(item.bsmRow.sectionCopy)" :key="ai" :label="a" |
| | | style="margin-bottom: 2px;margin-top: 2px;"></el-radio> |
| | | <el-radio v-for="(a, ai) in JSON.parse(item.bsmRow.sectionCopy)" :key="ai" :label="a" style="margin-bottom: 2px;margin-top: 2px;"></el-radio> |
| | | </el-radio-group> |
| | | </div> |
| | | </el-col> |
| | |
| | | <div class="search_label" style="width: 80px;">è¦æ±å¼ï¼</div> |
| | | <div class="search_input"> |
| | | <el-radio-group v-model="item.bsm1Val" v-removeAriaHidden @input="upBsmAll(item)"> |
| | | <el-radio v-for="(a, ai) in JSON.parse(item.bsmRow.sectionCopy)" :key="ai" :label="a">{{ |
| | | JSON.parse(item.bsmRow.askCopy)[ai] }}</el-radio> |
| | | <el-radio v-for="(a, ai) in JSON.parse(item.bsmRow.sectionCopy)" :key="ai" |
| | | :label="a">{{JSON.parse(item.bsmRow.askCopy)[ai]}}</el-radio> |
| | | </el-radio-group> |
| | | </div> |
| | | </el-col> |
| | |
| | | </span> |
| | | </el-dialog> |
| | | <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" |
| | | :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }" border :show-close="false" |
| | | :visible.sync="bsm3Dia" title="åºé´å¼å¡«å" width="800px"> |
| | | :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }" border |
| | | :show-close="false" :visible.sync="bsm3Dia" |
| | | title="åºé´å¼å¡«å" width="800px"> |
| | | <el-table :data="editTable" height="80vh" style="width: 100%"> |
| | | <!-- inspectionItemList --> |
| | | <el-table-column label="æ£éªé¡¹" prop="inspectionItemList" width="180"> |
| | |
| | | </el-table-column> |
| | | <el-table-column label="è¯å«ç¬¦å¼" prop="value"> |
| | | <template slot-scope="scope"> |
| | | <el-input v-model="scope.row.value" placeholder="请è¾å
¥" size="small" |
| | | @input="inputValueHandler(scope.row, scope.$index)"></el-input> |
| | | <el-input v-model="scope.row.value" placeholder="请è¾å
¥" size="small" @input="inputValueHandler(scope.row,scope.$index)"></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-row> |
| | | <el-button @click="bsm3Dia = false">å æ¶</el-button> |
| | | <el-button @click="bsm3Dia=false">å æ¶</el-button> |
| | | <el-button :loading="saveLoad" type="primary" @click="save0">ç¡® å®</el-button> |
| | | </el-row> |
| | | </span> |
| | | </el-dialog> |
| | | <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :show-close="false" |
| | | :visible.sync="dialogVisible" title="æç¤º" width="32%"> |
| | | <el-dialog |
| | | :close-on-click-modal="false" |
| | | :close-on-press-escape="false" |
| | | :show-close="false" |
| | | :visible.sync="dialogVisible" |
| | | title="æç¤º" |
| | | width="32%"> |
| | | <span>{{ dialogMessage }}</span> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button type="primary" @click="dialogVisible = false, closeOpenPage()">ç¡® å®</el-button> |
| | | <el-button type="primary" @click="dialogVisible= false,closeOpenPage()">ç¡® å®</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :show-close="false" |
| | | :visible.sync="dialogVisible2" title="æç¤º" width="32%"> |
| | | <el-dialog |
| | | :close-on-click-modal="false" |
| | | :close-on-press-escape="false" |
| | | :show-close="false" |
| | | :visible.sync="dialogVisible2" |
| | | title="æç¤º" |
| | | width="32%"> |
| | | <span>{{ dialogMessage2 }}</span> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button type="primary" @click="dialogVisible2 = false">ç¡® å®</el-button> |
| | |
| | | <el-button :loading="templateLoading" type="primary" @click="addTemplateDia">ç¡® å®</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :show-close="false" |
| | | :visible.sync="noNeedCheckDia" title="å
æ£æç¤º" width="32%"> |
| | | <el-dialog |
| | | :close-on-click-modal="false" |
| | | :close-on-press-escape="false" |
| | | :show-close="false" |
| | | :visible.sync="noNeedCheckDia" |
| | | title="å
æ£æç¤º" |
| | | width="32%"> |
| | | <span>确认å
æ£å½åæ£éªåï¼</span> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button :loading="noNeedCheckLoad" type="primary" @click="handleNoNeedCheck">ç¡® å®</el-button> |
| | |
| | | active: 0, |
| | | currentId: 0, |
| | | isReport: '', |
| | | editTable: [], // åºé´ç¹æ®å¼å¡«å |
| | | editTable:[], // åºé´ç¹æ®å¼å¡«å |
| | | template: null, |
| | | saveLoad: false, // ä¿åæé®loading |
| | | noNeedCheckLoad: false, // å
æ£æé®loading |
| | |
| | | addObj1: {}, |
| | | model: null, |
| | | standardMethodListId: null, |
| | | inspectionItem: null, |
| | | inspectionItemSubclass: null, |
| | | methodS: null, |
| | | inspectionItem:null, |
| | | inspectionItemSubclass:null, |
| | | methodS:null, |
| | | codeLevel: '', // æ ·åæå¨çº§å« |
| | | selectTreeTem: '', // æ ·åç¶çº§ |
| | | checkType: [], // æ£éªç±»åéé¡¹æ°æ® |
| | |
| | | templateName: '', // ä¿å模çåç§° |
| | | templates: [], // 模çä¸ææ¡æ°æ® |
| | | quantityList: [ |
| | | { label: 1, value: 1 }, |
| | | { label: 2, value: 2 }, |
| | | { label: 3, value: 3 }, |
| | | { label: 4, value: 4 }, |
| | | { label: 5, value: 5 }, |
| | | { label: 6, value: 6 }, |
| | | { label: 7, value: 7 }, |
| | | { label: 8, value: 8 }, |
| | | { label: 1, value: 1}, |
| | | { label: 2, value: 2}, |
| | | { label: 3, value: 3}, |
| | | { label: 4, value: 4}, |
| | | { label: 5, value: 5}, |
| | | { label: 6, value: 6}, |
| | | { label: 7, value: 7}, |
| | | { label: 8, value: 8}, |
| | | ], |
| | | types: [], // ç´§æ¥ç¨åº¦ä¸ææ¡ |
| | | dataTitle: [ |
| | |
| | | ], |
| | | dataIndex: 0, |
| | | isShowTab: false, |
| | | symbolList: ['RTS'], |
| | | symbolList:['RTS'], |
| | | bsm3Dia: false, // åºé´å¼å¡«åå¼¹æ¡ |
| | | bsmRow: {}, |
| | | bsm1: false, |
| | |
| | | this.getInfo() // è·åæ°æ® |
| | | }, |
| | | methods: { |
| | | save1() { |
| | | save1 () { |
| | | if (this.bsm1DiaList.length > 0) { |
| | | this.bsm1DiaList.forEach(item => { |
| | | if (!item.bsm1Val) { |
| | |
| | | done() |
| | | }, |
| | | //ç¹æ®å¼å¡«åå¤ç |
| | | inputValueHandler(row, index) { |
| | | if (row) { |
| | | const nextIndex = index + 1 |
| | | inputValueHandler(row,index){ |
| | | if(row){ |
| | | const nextIndex = index+1 |
| | | for (let i = nextIndex; i < this.editTable.length; i++) { |
| | | const element = this.editTable[i]; |
| | | if (element.model == row.model && row.symbolItem == element.symbolItem) { |
| | | if(element.model==row.model&&row.symbolItem==element.symbolItem){ |
| | | this.editTable[i].value = row.value |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | // æ¥çæ¶åæ¢tabæ |
| | | handleDataTab(m, i) { |
| | | handleDataTab (m, i) { |
| | | this.dataIndex = i |
| | | this.getInfo() |
| | | }, |
| | | // è·åæ°æ® |
| | | getInfo() { |
| | | getInfo () { |
| | | if (this.active == 2) { |
| | | let orderId = '' |
| | | if (!this.customsInspection.enterOrderId && this.customsInspection.quarterOrderId) { |
| | |
| | | } |
| | | }) |
| | | } else { |
| | | notificationRawOrder({ ifsInventoryId: this.customsInspection.id }).then(res => { |
| | | notificationRawOrder({ifsInventoryId:this.customsInspection.id}).then(res => { |
| | | if (res.code === 200) { |
| | | if (res.data === 1) { |
| | | if (this.orderType != 1) { |
| | |
| | | } |
| | | }) |
| | | // æ¥æ£æµç¨ |
| | | selectStandardTreeListByPartNo({ partNo: this.customsInspection.partNo }).then(res => { |
| | | selectStandardTreeListByPartNo({partNo:this.customsInspection.partNo}).then(res => { |
| | | if (res.data !== null) { |
| | | this.addObj.sample = res.data.label |
| | | this.codeLevel = res.data.code |
| | |
| | | }, |
| | | // æ¥è¯¢æ¨¡æ¿-åæ¾æ¨¡æ¿ |
| | | selectInsOrderTemplateByIdList(e) { |
| | | selectRawMaterOrderTemplateById({ id: e }).then(res => { |
| | | selectRawMaterOrderTemplateById({id: e}).then(res => { |
| | | let obj = JSON.parse(res.data) |
| | | this.sampleList = obj.sampleList; |
| | | this.productList = obj.sampleList[0].insProduct |
| | |
| | | thing: JSON.stringify({ |
| | | // addObj: this.addObj, |
| | | sampleList: sampleList, |
| | | selectTree: this.selectTree |
| | | selectTree:this.selectTree |
| | | }) |
| | | }).then(res => { |
| | | this.templateLoading = false; |
| | |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning" |
| | | }).then(() => { |
| | | delRawMaterOrderTemplate({ id: row.id }).then(res => { |
| | | delRawMaterOrderTemplate({id: row.id}).then(res => { |
| | | this.$message.success('å 餿å') |
| | | this.selectInsOrderTemplate() |
| | | }).catch(e => { |
| | | this.$message.error('å é¤å¤±è´¥') |
| | | }) |
| | | }).catch(() => { }) |
| | | }).catch(() => {}) |
| | | }, |
| | | // æ¥è¯¢æ¨¡æ¿å表 |
| | | selectInsOrderTemplate() { |
| | | selectRawMaterOrderTemplate({ partNo: this.addObj.partNo }).then(res => { |
| | | selectRawMaterOrderTemplate({partNo:this.addObj.partNo}).then(res => { |
| | | this.templates = res.data |
| | | }) |
| | | }, |
| | | // æå |
| | | handleSplitCountNum() { |
| | | handleSplitCountNum () { |
| | | this.sample.joinName = null |
| | | this.sample.joinModel = null |
| | | this.sample.joinNum = 1 |
| | |
| | | this.computationalPairing(this.sampleList.length) |
| | | }, |
| | | // æ£éªé¡¹å表çé |
| | | searchFilterList() { |
| | | searchFilterList () { |
| | | const vtw = { |
| | | inspectionItem: this.inspectionItem, // æ£éªé¡¹ |
| | | inspectionItemSubclass: this.inspectionItemSubclass, // æ£éªé¡¹å项 |
| | |
| | | }) |
| | | this.changeProductList0() |
| | | if (isHaveValue) { |
| | | for (let i in vtw) { |
| | | for(let i in vtw) { |
| | | if (vtw[i]) { |
| | | this.productList = this.productList0.filter((item) => { |
| | | return item[i] && item[i].includes(vtw[i]) |
| | |
| | | } |
| | | }, |
| | | containsValue(str) { |
| | | if (str) { |
| | | if(str){ |
| | | let symbolItem = '' |
| | | this.symbolList.some(value => { |
| | | if (str.includes(value)) { |
| | | symbolItem = value |
| | | this.symbolList.some(value =>{ |
| | | if(str.includes(value)){ |
| | | symbolItem = value |
| | | return true |
| | | } |
| | | }) |
| | |
| | | }) |
| | | this.getTotal(sampleList) |
| | | let projectNum = this.totalArr.filter(a => a.state == 1).length |
| | | if (projectNum == 0) { |
| | | if(projectNum==0){ |
| | | this.$confirm('æ£éªé¡¹ç®ä¸ºç©ºï¼æ¯å¦ç¡®è®¤æäº¤?', "æç¤º", { |
| | | confirmButtonText: "ç¡®å®", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning" |
| | | }).then(() => { |
| | | this.saveMethod(sampleList) |
| | | }).catch(() => { }) |
| | | } else { |
| | | let isRTS = this.totalArr.find(a => a.ask != null && this.symbolList.find(b => a.ask.includes(b)) && a.state == 1) |
| | | }).catch(() => {}) |
| | | }else{ |
| | | let isRTS = this.totalArr.find(a => a.ask != null && this.symbolList.find(b=>a.ask.includes(b)) && a.state == 1) |
| | | if (isRTS) { |
| | | this.editTable = this.handleData(sampleList, this.containsValue, 0) |
| | | this.editTable = this.handleData(sampleList,this.containsValue, 0) |
| | | this.editTable.forEach(item => { |
| | | item.value = item.modelNum |
| | | }) |
| | |
| | | }); |
| | | }, |
| | | // æäº¤åºé´å¼ |
| | | save0() { |
| | | if (this.editTable.every(m => m.value)) { |
| | | save0(){ |
| | | if(this.editTable.every(m=>m.value)){ |
| | | this.sampleList.forEach(item => { |
| | | item.insProduct = this.productList |
| | | }) |
| | | let sampleList = this.handleData(this.HaveJson(this.sampleList), this.handleAsk, 1) |
| | | let sampleList = this.handleData(this.HaveJson(this.sampleList),this.handleAsk,1) |
| | | sampleList.forEach(a => { |
| | | a.insProduct = a.insProduct.filter(b => b.state === 1) |
| | | a.insProduct = a.insProduct.filter(b=>b.state === 1) |
| | | }) |
| | | this.saveMethod(sampleList) |
| | | } else { |
| | | }else{ |
| | | this.$message.error('请填åè¯å«ç¬¦å¼') |
| | | } |
| | | }, |
| | | noNeedCheck() { |
| | | noNeedCheck () { |
| | | this.$refs['addObj'].validate((valid) => { |
| | | if (valid) { |
| | | if (!this.sampleList.every(m => m.standardMethodListId)) { |
| | |
| | | }) |
| | | this.getTotal(sampleList) |
| | | let projectNum = this.totalArr.filter(a => a.state == 1).length |
| | | if (projectNum != 0) { |
| | | if (projectNum!=0){ |
| | | this.$message.error('å
æ£ä¸å¯éæ©æ£éªé¡¹') |
| | | return |
| | | } |
| | |
| | | } |
| | | }); |
| | | }, |
| | | handleNoNeedCheck() { |
| | | handleNoNeedCheck () { |
| | | // æ£éªç±»å为è¿åæ£éªæ¶å¯éæ©å
æ£ï¼ä½ä¸è½éæ©æ£éªé¡¹ |
| | | const sampleList = this.HaveJson(this.sampleList) |
| | | sampleList.forEach(item => { |
| | |
| | | } else { |
| | | a.model = a.model + ((a.modelNum == null || a.modelNum == '' || a.modelNum == 'null') ? '' : ('-' + a.modelNum)) |
| | | } |
| | | a.insProduct = a.insProduct.filter(b => b.state === 1) |
| | | a.insProduct = a.insProduct.filter(b=>b.state === 1) |
| | | return a |
| | | }), |
| | | }).then(res => { |
| | |
| | | this.noNeedCheckDia = false |
| | | this.$message.success('å·²æäº¤') |
| | | this.closeOpenPage() |
| | | }).catch(e => { |
| | | }).catch(e=>{ |
| | | this.noNeedCheckLoad = false |
| | | }) |
| | | }, |
| | | saveMethod(sampleList) { |
| | | saveMethod(sampleList){ |
| | | let trees = this.selectTree.split(" - ") |
| | | if (trees.length < 3) { |
| | | this.$message.error('æªéæ©å¯¹è±¡') |
| | |
| | | } else { |
| | | a.model = a.model + ((a.modelNum == null || a.modelNum == '' || a.modelNum == 'null') ? '' : ('-' + a.modelNum)) |
| | | } |
| | | a.insProduct = a.insProduct.filter(b => b.state === 1) |
| | | a.insProduct = a.insProduct.filter(b=>b.state === 1) |
| | | return a |
| | | }), |
| | | }).then(res => { |
| | |
| | | this.$message.success('å·²æäº¤') |
| | | this.bsm3Dia = false; |
| | | this.closeOpenPage() |
| | | }).catch(e => { |
| | | }).catch(e=>{ |
| | | this.saveLoad = false |
| | | }) |
| | | }, |
| | | handleAsk(ask, symbolItem, value) { |
| | | try { |
| | | handleAsk(ask,symbolItem, value) { |
| | | try{ |
| | | let code = [">", "<", "=", "ï¼", "ï¼", "â¥", "â¤", "±", "*", "/"]; |
| | | let code2 = ['+', '*', '/', '-'] |
| | | if (ask.includes('&')) { |
| | |
| | | return code[index] + '' + num |
| | | } |
| | | } |
| | | } catch (e) { } |
| | | }catch(e){} |
| | | }, |
| | | handleData(sampleList, calBack, type) { |
| | | handleData(sampleList,calBack,type){ |
| | | let editTable = [] |
| | | sampleList.forEach(item => { |
| | | let obj = { |
| | | sampleCode: item.sampleCode, |
| | | model: item.model, |
| | | symbolList: [], |
| | | sampleId: item.id, |
| | | modelNum: item.modelNum, |
| | | sampleCode:item.sampleCode, |
| | | model:item.model, |
| | | symbolList:[], |
| | | sampleId:item.id, |
| | | modelNum:item.modelNum, |
| | | } |
| | | if (item.insProduct && item.insProduct.length > 0) { |
| | | item.insProduct.forEach(a => { |
| | | if (a.state == 1) { |
| | | if (type == 0) { |
| | | if(type==0){ |
| | | let str = calBack(a.ask) |
| | | str && obj.symbolList.push({ |
| | | symbolItem: str, |
| | | inspectionItem: a.inspectionItem, |
| | | str&&obj.symbolList.push({ |
| | | symbolItem:str, |
| | | inspectionItem:a.inspectionItem, |
| | | }) |
| | | } else if (type == 1) { |
| | | }else if(type==1){ |
| | | let arr = this.editTable.filter(b => b.sampleId == item.id) |
| | | for (var i = 0; i < arr.length; i++) { |
| | | if (a.ask) { |
| | | if (a.ask.includes(arr[i].symbolItem)) { |
| | | let ask = calBack(a.ask, arr[i].symbolItem, arr[i].value) |
| | | for (var i=0;i<arr.length;i++){ |
| | | if(a.ask){ |
| | | if(a.ask.includes(arr[i].symbolItem)){ |
| | | let ask = calBack(a.ask, arr[i].symbolItem,arr[i].value) |
| | | if (ask) { |
| | | a.ask = ask |
| | | } |
| | | let tell = this.handleAsk(a.tell, arr[i].symbolItem, arr[i].value) |
| | | let tell = this.handleAsk(a.tell, arr[i].symbolItem,arr[i].value) |
| | | if (tell) { |
| | | a.tell = tell |
| | | } |
| | | } |
| | | } else { |
| | | }else{ |
| | | this.$message.error('è¦æ±å¼ä¸ºç©ºï¼éè¦å»æ ååºç»´æ¤ï¼') |
| | | } |
| | | } |
| | |
| | | if (b.productList && b.productList.length > 0) { |
| | | b.productList.forEach(c => { |
| | | if (c.state == 1) { |
| | | if (type == 0) { |
| | | if(type==0){ |
| | | let str = calBack(c.ask) |
| | | str && obj.symbolList.push({ |
| | | symbolItem: str, |
| | | inspectionItem: c.inspectionItem, |
| | | str&&obj.symbolList.push({ |
| | | symbolItem:str, |
| | | inspectionItem:c.inspectionItem, |
| | | }) |
| | | } else if (type == 1) { |
| | | }else if(type==1){ |
| | | let arr = this.editTable.filter(b => b.sampleId == item.id) |
| | | arr.forEach(f => { |
| | | if (c.ask.includes(f.symbolItem)) { |
| | | let ask = calBack(c.ask, f.symbolItem, f.value) |
| | | if(c.ask.includes(f.symbolItem)){ |
| | | let ask = calBack(c.ask, f.symbolItem,f.value) |
| | | if (ask) { |
| | | c.ask = ask |
| | | } |
| | | let tell = this.handleTell(c.tell, f.symbolItem, f.value) |
| | | let tell = this.handleTell(c.tell, f.symbolItem,f.value) |
| | | if (tell) { |
| | | c.tell = tell |
| | | } |
| | |
| | | if (b.productList && b.productList.length > 0) { |
| | | b.productList.forEach(c => { |
| | | if (c.state == 1) { |
| | | if (type == 0) { |
| | | if(type==0){ |
| | | let str = calBack(c.ask) |
| | | str && obj.symbolList.push({ |
| | | symbolItem: str, |
| | | inspectionItem: c.inspectionItem, |
| | | str&&obj.symbolList.push({ |
| | | symbolItem:str, |
| | | inspectionItem:c.inspectionItem, |
| | | }) |
| | | } else if (type == 1) { |
| | | }else if(type==1){ |
| | | // let ask = calBack(c.ask, c.rts) |
| | | // if (ask && c.state == 1) { |
| | | // c.ask = csk |
| | | // } |
| | | let arr = this.editTable.filter(b => b.sampleId == item.id) |
| | | arr.forEach(f => { |
| | | if (c.ask.includes(f.symbolItem)) { |
| | | let ask = calBack(c.ask, f.symbolItem, f.value) |
| | | if(c.ask.includes(f.symbolItem)){ |
| | | let ask = calBack(c.ask, f.symbolItem,f.value) |
| | | if (ask) { |
| | | c.ask = ask |
| | | } |
| | | let tell = this.handleTell(c.tell, f.symbolItem, f.value) |
| | | let tell = this.handleTell(c.tell, f.symbolItem,f.value) |
| | | if (tell) { |
| | | c.tell = tell |
| | | } |
| | |
| | | if (c.productList && c.productList.length > 0) { |
| | | c.productList.forEach(d => { |
| | | if (d.state == 1) { |
| | | if (type == 0) { |
| | | if(type==0){ |
| | | let str = calBack(d.ask) |
| | | str && obj.symbolList.push({ |
| | | symbolItem: str, |
| | | inspectionItem: d.inspectionItem, |
| | | str&&obj.symbolList.push({ |
| | | symbolItem:str, |
| | | inspectionItem:d.inspectionItem, |
| | | }) |
| | | } else if (type == 1) { |
| | | }else if(type==1){ |
| | | // let ask = calBack(d.ask, d.rts) |
| | | // if (ask && d.state == 1) { |
| | | // d.ask = ask |
| | | // } |
| | | let arr = this.editTable.filter(b => b.sampleId == item.id) |
| | | arr.forEach(f => { |
| | | if (d.ask.includes(f.symbolItem)) { |
| | | let ask = calBack(d.ask, f.symbolItem, f.value) |
| | | if(d.ask.includes(f.symbolItem)){ |
| | | let ask = calBack(d.ask, f.symbolItem,f.value) |
| | | if (ask) { |
| | | d.ask = ask |
| | | } |
| | | let tell = this.handleTell(d.tell, f.symbolItem, f.value) |
| | | let tell = this.handleTell(d.tell, f.symbolItem,f.value) |
| | | if (tell) { |
| | | d.tell = tell |
| | | } |
| | |
| | | } |
| | | }) |
| | | } |
| | | if (type == 0) { |
| | | if(type==0){ |
| | | editTable.push(obj) |
| | | } |
| | | }) |
| | | if (type == 0) { |
| | | if(type==0){ |
| | | editTable.forEach(a => { |
| | | a.symbolList.forEach(b => { |
| | | let arr = a.symbolList.filter(c => c.symbolItem == b.symbolItem); |
| | |
| | | }) |
| | | editTable.forEach(a => { |
| | | let mySet = new Set(); |
| | | a.symbolList = a.symbolList.filter(b => { |
| | | a.symbolList = a.symbolList.filter(b =>{ |
| | | let num0 = mySet.size; |
| | | mySet.add(b.symbolItem); |
| | | let num1 = mySet.size; |
| | | if (num0 != num1) { |
| | | if(num0!=num1){ |
| | | return true; |
| | | } else { |
| | | }else{ |
| | | return false |
| | | } |
| | | }) |
| | |
| | | editTable.forEach(a => { |
| | | a.symbolList.forEach(b => { |
| | | let obj = { |
| | | sampleCode: a.sampleCode, |
| | | model: a.model, |
| | | symbolItem: b.symbolItem, |
| | | sampleId: a.sampleId, |
| | | value: null, |
| | | inspectionItemList: b.inspectionItemList, |
| | | modelNum: a.modelNum, |
| | | sampleCode:a.sampleCode, |
| | | model:a.model, |
| | | symbolItem:b.symbolItem, |
| | | sampleId:a.sampleId, |
| | | value:null, |
| | | inspectionItemList:b.inspectionItemList, |
| | | modelNum:a.modelNum, |
| | | } |
| | | editTableNew.push(obj) |
| | | }) |
| | | }) |
| | | return editTableNew |
| | | } else { |
| | | }else{ |
| | | return sampleList |
| | | } |
| | | }, |
| | |
| | | } catch (e) { |
| | | } |
| | | }, |
| | | replaceAll(str, find, value) { |
| | | replaceAll(str,find,value) { |
| | | if (str === undefined) { |
| | | return str |
| | | } |
| | |
| | | let num1 = mySet0.size |
| | | mySet0.add(item.sonLaboratory) |
| | | let num2 = mySet0.size |
| | | if (num2 > num1) { |
| | | if(num2>num1){ |
| | | this.sonLaboratoryList.push({ |
| | | label: item.sonLaboratory, |
| | | value: item.sonLaboratory, |
| | | label:item.sonLaboratory, |
| | | value:item.sonLaboratory, |
| | | }) |
| | | } |
| | | }) |
| | |
| | | } else { |
| | | this.methods = res.data.standardMethodList |
| | | } |
| | | } catch (e) { } |
| | | } catch (e) {} |
| | | }) |
| | | }, |
| | | // èµå¼ç¬¬ä¸æ¡é»è®¤æ°æ® |
| | | addListInfo(codeLevel, data) { |
| | | addListInfo (codeLevel, data) { |
| | | this.sampleList = [] |
| | | this.productList = [] |
| | | this.sample.model = this.addObj.model |
| | |
| | | } |
| | | this.bsm2Val3 = this.HaveJson(this.permute(nums)) |
| | | }, |
| | | tableRowClassName({ row, rowIndex }) { |
| | | tableRowClassName({row, rowIndex}) { |
| | | if (row.state === 0) { |
| | | return ''; |
| | | } |
| | | return 'warning-row'; |
| | | }, |
| | | // ä¿®æ¹æ ·ååç§° |
| | | changeValue(val, string) { |
| | | changeValue (val, string) { |
| | | if (this.sampleList.length > 1) { |
| | | // æä¸¤æ¡æ ·åæ¶ï¼ç¬¬äºæ¡æ ·åä¿¡æ¯åç¬¬ä¸æ¡ä¿æä¸è´ |
| | | this.sampleList.forEach(item => { |
| | |
| | | } |
| | | this.getProductLoad = true |
| | | let selectTreeList = this.selectTree.split(" - ") |
| | | this.addObj.model && (selectTreeList[selectTreeList.length - 1] = this.addObj.model) |
| | | this.addObj.model&&(selectTreeList[selectTreeList.length - 1] = this.addObj.model) |
| | | selectStandardProductList({ |
| | | model: this.addObj.model ? this.addObj.model : row.model, |
| | | model: this.addObj.model?this.addObj.model:row.model, |
| | | modelNum: row.modelNum, |
| | | standardMethodListId: val, |
| | | factory: selectTreeList.join(" - "), |
| | |
| | | }) |
| | | }, 200) |
| | | }).catch(err => { |
| | | console.log('err-', err) |
| | | console.log('err-',err) |
| | | }) |
| | | }, |
| | | // éæ©æ ·ååå·çåè° |
| | |
| | | } |
| | | }, |
| | | // å
¨éç¹æ®å¼å¤çæ¡éæ©è¦æ±å¼çåè° |
| | | upBsmAll(item) { |
| | | upBsmAll (item) { |
| | | const i = this.bsm1DiaList.findIndex(obj => obj.id === item.id) |
| | | if (i > -1) { |
| | | // æ¾å°ç¸åºçæ£éªé¡¹èµå¼ |
| | |
| | | selectOne(selection, row) { |
| | | this.bsm1DiaList = [] |
| | | row.state = row.state == 1 ? 0 : 1 |
| | | if (row.section === null) { |
| | | if(row.section === null) { |
| | | row.section = "" |
| | | } |
| | | if (row.sectionCopy === undefined && row.section) { |
| | |
| | | if (row.tell.includes('[')) { |
| | | this.$set(row, 'tellCopy', row.tell) |
| | | } |
| | | let arr = this.productList.filter(m => m.state == 1 && row.sectionCopy && row.sectionCopy.includes(m.sectionCopy) && m.ask && m.sectionCopy.indexOf('[') == -1) |
| | | if (row.bsm === '1' && row.sectionCopy !== '' && row.sectionCopy !== null && row.sectionCopy !== undefined && row.state === 1 && arr.length == 0) { |
| | | let arr = this.productList.filter(m=>m.state==1&&row.sectionCopy&&row.sectionCopy.includes(m.sectionCopy)&&m.ask&&m.sectionCopy.indexOf('[')==-1) |
| | | if (row.bsm === '1' && row.sectionCopy !== '' && row.sectionCopy !== null && row.sectionCopy !== undefined && row.state === 1&&arr.length==0) { |
| | | if (row.sectionCopy.indexOf('[') > -1) { |
| | | row.bsmRow = this.HaveJson(row) |
| | | } |
| | | row.bsm1 = true |
| | | this.bsm1DiaList.push(row) |
| | | this.bsm1DiaAll = true |
| | | } else if (row.bsm === '1' && row.sectionCopy !== '' && row.sectionCopy !== null && row.state === 0 && arr.length == 0) { |
| | | } else if (row.bsm === '1' && row.sectionCopy !== '' && row.sectionCopy !== null && row.state === 0&&arr.length==0) { |
| | | row.bsm1 = false |
| | | } else if (arr.length > 0) { |
| | | try { |
| | | }else if(arr.length>0){ |
| | | try{ |
| | | row.bsmRow = this.HaveJson(row) |
| | | let section = arr[0].section |
| | | let arr0 = JSON.parse(row.section) |
| | |
| | | row.section = section |
| | | row.ask = arr1[index] |
| | | row.tell = arr4[index] |
| | | } catch (e) { } |
| | | } catch(e) {} |
| | | } |
| | | this.sampleList.map(item => { |
| | | if (this.sampleIds.indexOf(item.id) > -1) { |
| | |
| | | handleAll(e) { |
| | | if (e.length > 0) { |
| | | this.productList.map(m => { |
| | | if (e.find(a => a.id == m.id)) { |
| | | if(e.find(a=>a.id == m.id)){ |
| | | m.state = 1 |
| | | } |
| | | return m |
| | |
| | | this.$refs.productTable.doLayout() |
| | | }) |
| | | }, |
| | | changeProductList0() { |
| | | this.productList0.forEach(a => { |
| | | changeProductList0(){ |
| | | this.productList0.forEach(a=>{ |
| | | let obj = this.productList.find(m => m.id == a.id) |
| | | if (obj) { |
| | | if(obj){ |
| | | a.state = obj.state |
| | | a.section = obj.section |
| | | a.ask = obj.ask |
| | |
| | | // a.price = obj.price |
| | | a.tell = obj.tell |
| | | } |
| | | if (a.state == 0 && a.bsmRow) { |
| | | if(a.state == 0&&a.bsmRow){ |
| | | a = this.HaveJson(a.bsmRow) |
| | | } |
| | | }) |
| | |
| | | const property = column['property']; |
| | | return row[property] === value; |
| | | }, |
| | | goBack() { |
| | | goBack () { |
| | | if (this.active == 1) { |
| | | this.$router.go(-1) |
| | | } else { |
| | |
| | | justify-content: space-between; |
| | | margin-bottom: 10px; |
| | | } |
| | | |
| | | .tab { |
| | | list-style-type: none; |
| | | display: flex; |
| | |
| | | background-color: #ffffff; |
| | | |
| | | } |
| | | >>>.warning-row { |
| | | color: #1890FF; |
| | | } |
| | | </style> |
| | |
| | | ], |
| | | page: { |
| | | total: 0, |
| | | size: 10, |
| | | size: 20, |
| | | current: 1 |
| | | }, |
| | | tableData1: [], |
| | |
| | | ], |
| | | page1: { |
| | | total: 0, |
| | | size: 10, |
| | | size: 20, |
| | | current: 1 |
| | | }, |
| | | tableData2: [], |
| | |
| | | { label: 'é¶ä»¶æè¿°', prop: 'partDesc' }, |
| | | { label: 'ä¾åºååç§°', prop: 'supplierName' }, |
| | | { label: 'ä¸åæ ¼æè¿°', prop: 'unqualifiedDesc' }, |
| | | { label: 'å
æ£', prop: 'isExemption' }, |
| | | { |
| | | dataType: 'tag', |
| | | label: 'å
æ£', |
| | | prop: 'isExemption', |
| | | formatData: (params) => { |
| | | if (params == 1) { |
| | | return 'å
æ£' |
| | | } else { |
| | | return null |
| | | } |
| | | }, |
| | | formatType: (params) => { |
| | | if (params == 1) { |
| | | return 'success' |
| | | } else { |
| | | return null |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | label: 'æ ·ååç§°', |
| | | prop: 'sampleName', |
| | |
| | | ], |
| | | page2: { |
| | | total: 0, |
| | | size: 10, |
| | | size: 20, |
| | | current: 1 |
| | | }, |
| | | tableData3: [], |
| | |
| | | { label: 'é¶ä»¶æè¿°', prop: 'partDesc' }, |
| | | { label: 'ä¾åºååç§°', prop: 'supplierName' }, |
| | | { label: 'ä¸åæ ¼æè¿°', prop: 'unqualifiedDesc' }, |
| | | { label: 'å
æ£', prop: 'isExemption' }, |
| | | { |
| | | dataType: 'tag', |
| | | label: 'å
æ£', |
| | | prop: 'isExemption', |
| | | formatData: (params) => { |
| | | if (params == 1) { |
| | | return 'å
æ£' |
| | | } else { |
| | | return null |
| | | } |
| | | }, |
| | | formatType: (params) => { |
| | | if (params == 1) { |
| | | return 'success' |
| | | } else { |
| | | return null |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | label: 'æ ·ååç§°', |
| | | prop: 'sampleName', |
| | |
| | | ], |
| | | page3: { |
| | | total: 0, |
| | | size: 10, |
| | | size: 20, |
| | | current: 1 |
| | | }, |
| | | tableData4: [], |
| | |
| | | { label: 'é¶ä»¶æè¿°', prop: 'partDesc' }, |
| | | { label: 'ä¾åºååç§°', prop: 'supplierName' }, |
| | | { label: 'ä¸åæ ¼æè¿°', prop: 'unqualifiedDesc' }, |
| | | { label: 'å
æ£', prop: 'isExemption' }, |
| | | { |
| | | dataType: 'tag', |
| | | label: 'å
æ£', |
| | | prop: 'isExemption', |
| | | formatData: (params) => { |
| | | if (params == 1) { |
| | | return 'å
æ£' |
| | | } else { |
| | | return null |
| | | } |
| | | }, |
| | | formatType: (params) => { |
| | | if (params == 1) { |
| | | return 'success' |
| | | } else { |
| | | return null |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | label: 'æ ·ååç§°', |
| | | prop: 'sampleName', |
| | |
| | | ], |
| | | page4: { |
| | | total: 0, |
| | | size: 10, |
| | | size: 20, |
| | | current: 1 |
| | | }, |
| | | entity: { |
| | |
| | | } from "@/api/business/rawMaterialOrder"; |
| | | import { |
| | | addInsOrder, addInsOrderTemplate, delInsOrderTemplate, |
| | | getQuarterOnOrder, |
| | | getQuarterOnOrder, selectInsOrderTemplateById, |
| | | selectOrderManDay, |
| | | updateInsOrder, |
| | | upInsOrder, |
| | |
| | | import {selectsStandardMethodByFLSSM} from "@/api/standard/standardLibrary"; |
| | | import limsTable from "@/components/Table/lims-table.vue"; |
| | | import {selectCustomPageList} from "@/api/system/customer"; |
| | | import {mapGetters} from "vuex"; |
| | | |
| | | export default { |
| | | name: 'Add', |
| | |
| | | limsTable, |
| | | cableConfig, |
| | | AuxiliaryWireCore |
| | | }, |
| | | computed:{ |
| | | ...mapGetters(["nickName"]), |
| | | }, |
| | | dicts: ['check_type1', 'urgency_level', 'form_type', 'sample_status_list'], |
| | | data() { |
| | |
| | | }, |
| | | // è·åç¨æ·å表 |
| | | getAuthorizedPerson() { |
| | | selectUserCondition().then(res => { |
| | | selectUserCondition({ type: 1 }).then(res => { |
| | | let data = [] |
| | | res.data.forEach(a => { |
| | | data.push({ |
| | |
| | | sampleList.forEach(a => { |
| | | if (a.insProduct.length > 0) { |
| | | a.insProduct.forEach(c => { |
| | | delete c.id |
| | | if (this.tabIndex != 4) { |
| | | delete c.id |
| | | } |
| | | }) |
| | | } |
| | | if (a.endModels) { |
| | |
| | | sampleList.forEach(a => { |
| | | if (a.insProduct.length > 0) { |
| | | a.insProduct.forEach(c => { |
| | | delete c.id |
| | | if (this.tabIndex != 4) { |
| | | delete c.id |
| | | } |
| | | }) |
| | | } |
| | | if (a.endModels) { |
| | |
| | | } |
| | | }, |
| | | saveMethod(sampleList){ |
| | | console.log('sampleList----', sampleList) |
| | | this.saveLoad = true |
| | | if (this.addObj.quarterItemId) { |
| | | this.addObj.quarterItemId = this.addObj.quarterItemId[1] |
| | | } |
| | | if(this.tabIndex==4&&this.active==2){ |
| | | if (this.addObj.createTime) { |
| | | delete this.addObj.createTime |
| | | } |
| | | // éååæäº¤ |
| | | updateInsOrder({insOrder: this.addObj, sampleList: sampleList}).then(res => { |
| | | updateInsOrder({insOrder: this.addObj, sampleProduct: sampleList}).then(res => { |
| | | this.saveLoad = false |
| | | this.$message.success('å·²æäº¤') |
| | | this.bsm3Dia = false; |
| | |
| | | if (node.data.code === '[3]') { |
| | | this.sampleViewEn = val.sampleTypeEn |
| | | } else if (node.data.code === '[4]') { |
| | | console.log('node.data---', node.data) |
| | | if (node.data.children!==null && node.data.children.length>0) { |
| | | this.sampleViewEn = val.sampleEn |
| | | } |
| | |
| | | backtrack([], nums); |
| | | return result; |
| | | }, |
| | | tableRowClassName({ |
| | | row, |
| | | rowIndex |
| | | }) { |
| | | if (row.state === 0) { |
| | | tableRowClassName({row, rowIndex}) { |
| | | if (row.state == 1) { |
| | | return 'warning-row'; |
| | | } else { |
| | | return ''; |
| | | } |
| | | return 'warning-row'; |
| | | }, |
| | | selectInsOrderTemplate() { |
| | | selectInsOrderTemplate({company: this.addObj.company}).then(res => { |
| | |
| | | selectInsOrderTemplateById({id: e}).then(res => { |
| | | let obj = JSON.parse(res.data) |
| | | //å¶å人设置为å½åç»å½ç¨æ· |
| | | let user = JSON.parse(localStorage.getItem('user')) |
| | | let user = this.nickName |
| | | obj.addObj.custom = user.name |
| | | obj.addObj.userId = user.userId |
| | | this.addObj = obj.addObj; |
| | | this.sampleList = obj.sampleList; |
| | | this.selectTree = obj.selectTree |
| | | this.rowClick(this.sampleList[0]) |
| | | }) |
| | | }, |
| | | delSampleAndProduct() { |
| | |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .el-table .warning-row .cell { |
| | | color: #3A7BFA; |
| | | >>>.warning-row { |
| | | color: #1890FF; |
| | | } |
| | | .node_i { |
| | | color: orange; |
| | | font-size: 18px; |
| | | } |
| | | </style> |
| | |
| | | this.$refs.productTable.doLayout() |
| | | }) |
| | | }, |
| | | tableRowClassName({ |
| | | row, |
| | | rowIndex |
| | | }) { |
| | | tableRowClassName({row, rowIndex}) { |
| | | if (row.state === 0) { |
| | | return ''; |
| | | } |
| | |
| | | font-size: 12px; |
| | | } |
| | | |
| | | .ins_order_config .el-table .warning-row .cell { |
| | | color: #3A7BFA; |
| | | >>>.warning-row { |
| | | color: #1890FF; |
| | | } |
| | | </style> |
| | |
| | | display: flex; |
| | | justify-content: space-between; |
| | | } |
| | | .el-table .warning-row .cell { |
| | | color: #3A7BFA; |
| | | >>>.warning-row { |
| | | color: #1890FF; |
| | | } |
| | | </style> |
| | |
| | | }).then(res => { |
| | | if (res.code === 200 && res.data.length > 0) { |
| | | res.data.forEach(item => { |
| | | console.log('item---', item) |
| | | item.sendTime = item.sendTime && item.sendTime.substring(0, 10) |
| | | item.sampleNumber = item.qtyArrived + item.buyUnitMeas |
| | | this.$set(item, 'barcode', item.entrustCode) |
| | |
| | | ], |
| | | page: { |
| | | total: 0, |
| | | size: 10, |
| | | size: 20, |
| | | current: 1 |
| | | }, |
| | | state: 0,// 0:å°è´¦é¡µï¼1ï¼æ£éªé¡µé¢,2æ£éªé¡µé¢(夿 ¸)ï¼é»è®¤ä¸º0,3æ°æ®æ¥ç |
| | |
| | | tableDataLook: [], |
| | | tableDataLookPage: { |
| | | total: 0, |
| | | size: 10, |
| | | size: 20, |
| | | current: 1 |
| | | }, |
| | | tableDataLookColumn: [ |
| | |
| | | ], |
| | | pageFile: { |
| | | total: 0, |
| | | size: 10, |
| | | size: 20, |
| | | current: 1 |
| | | }, |
| | | formData: {}, |
| | |
| | | ], |
| | | pageDelete: { |
| | | total: 0, |
| | | size: 10, |
| | | size: 20, |
| | | current: 1 |
| | | }, |
| | | deleteDialogVisible: false, |
| | |
| | | path: "/productOrder/add", query: { |
| | | examine: 1, |
| | | active: 2, |
| | | currentId: row.id |
| | | currentId: row.id, |
| | | tabIndex: this.tabIndex, |
| | | } |
| | | }); |
| | | }, |
| | |
| | | closeDia () { |
| | | this.tableDataLookPage = { |
| | | total: 0, |
| | | size: 10, |
| | | size: 20, |
| | | current: 1 |
| | | } |
| | | this.dataDialogVisible = false |
| | |
| | | }, |
| | | getDeleteList() { |
| | | this.tableLoadingDelete = true |
| | | selectNoProducts({ orderId: this.orderId, revocationInsProductIds: this.revocationInsProductIds }).then(res => { |
| | | selectNoProducts({ orderId: this.orderId, revocationInsProductIds: this.revocationInsProductIds, ...this.pageDelete }).then(res => { |
| | | this.tableLoadingDelete = false |
| | | this.componentDataDelete = res.data.records |
| | | this.pageDelete.total = res.data.total |
| | |
| | | } |
| | | }, |
| | | getUserList(){ |
| | | selectUserCondition({ type: 0 }).then((res) => { |
| | | selectUserCondition().then((res) => { |
| | | this.userList = res.data; |
| | | }) |
| | | }, |
| | |
| | | ], |
| | | page: { |
| | | total: 0, |
| | | size: 10, |
| | | size: 20, |
| | | current: 1 |
| | | }, |
| | | tableData1: [], |
| | |
| | | ], |
| | | page1: { |
| | | total: 0, |
| | | size: 10, |
| | | size: 20, |
| | | current: 1 |
| | | }, |
| | | yearSampleDia: false, // å¹´åº¦æ½æ · |
| | |
| | | return 'height: calc(100% - ' + '44' + 'px)' |
| | | }, |
| | | getUserList() { |
| | | selectUserCondition({ type: 0 }).then((res) => { |
| | | selectUserCondition().then((res) => { |
| | | this.userList = res.data; |
| | | }) |
| | | }, |
| | |
| | | <el-button size="small" style="height: 38px" type="primary">éä»¶ä¸ä¼ </el-button> |
| | | </el-upload> |
| | | </div> |
| | | <lims-table :tableData="tableDataFile" :column="columnFile" height="500px" key="tableDataFile" |
| | | :tableLoading="tableLoadingFile"></lims-table> |
| | | <lims-table :tableData="tableDataFile" :column="columnFile" height="500px" |
| | | key="tableDataFile" :tableLoading="tableLoadingFile"></lims-table> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | |
| | | import { mapGetters } from "vuex"; |
| | | import { selectUserCondition } from "@/api/business/inspectionTask"; |
| | | import limsTable from "@/components/Table/lims-table.vue"; |
| | | import { delFile, downFile, getFileList } from "@/api/business/rawMaterialOrder"; |
| | | import {delFile, downFile, getFileList} from "@/api/business/rawMaterialOrder"; |
| | | export default { |
| | | name: 'ReportPreparation', |
| | | components: { limsTable, onlyoffice }, |
| | |
| | | }, |
| | | // è·å人åå表 |
| | | getAuthorizedPerson() { |
| | | selectUserCondition({ type: 0 }).then((res) => { |
| | | selectUserCondition({ type: 1 }).then((res) => { |
| | | let data = []; |
| | | res.data.forEach((a) => { |
| | | data.push({ |
| | |
| | | // æ¹æ³éå |
| | | methods: { |
| | | async getInsOrder(operationType, item) { |
| | | console.log('operationType----', operationType) |
| | | this.operationType = operationType |
| | | this.info = item |
| | | // æ¥è¯¢å·²æäº¤çæ°æ® |
| | |
| | | ], |
| | | page: { |
| | | total: 0, |
| | | size: 10, |
| | | size: 20, |
| | | current: 1 |
| | | }, |
| | | } |
| | |
| | | }) |
| | | .then(() => { |
| | | deleteAuxiliaryWorkingHours({ id: row.id }).then((res) => { |
| | | console.log('res', res) |
| | | if (res.code == 200) { |
| | | if (res.code == 200){ |
| | | this.$message.success("å 餿å"); |
| | | this.refresh(); |
| | | } |
| | |
| | | export default { |
| | | data() { |
| | | return { |
| | | SSO: window.location.hash |
| | | } |
| | | }; |
| | | }, |
| | | created() { |
| | | this.initLogin() |
| | | console.log(this.SSO) |
| | | this.initLogin(); |
| | | }, |
| | | methods: { |
| | | initLogin() { |
| | | const code = this.SSO.split('&')[0].split('=')[1] |
| | | console.log(code) |
| | | |
| | | if (code) { |
| | | this.$store.dispatch('LoginBySSO', code).then(() => { |
| | | this.$router.push({ path: '/' }) |
| | | }) |
| | | } |
| | | this.$store.dispatch('LoginBySSO', {code: this.$route.query.code}).then(() => { |
| | | this.$router.push({path: '/'}); |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | | <style scoped></style> |
| | | <style scoped></style> |
ÎļþÃû´Ó src/InspectionWorker.worker.js ÐÞ¸Ä |
| | |
| | | // å¤çº¿ç¨éé¢éè¦ä¿åçæ°æ® |
| | | import Big from "big.js"; |
| | | |
| | | let code = ""; |
| | | // è¡¨æ ¼æ°æ®ï¼æ¸²æï¼ |
| | | let tableList = null; |
| | |
| | | console.log("error", error); |
| | | } |
| | | } |
| | | |
| | | /* |
| | | * big.js v5.2.2 |
| | | * A small, fast, easy-to-use library for arbitrary-precision decimal arithmetic. |
| | | * Copyright (c) 2018 Michael Mclaughlin <M8ch88l@gmail.com> |
| | | * https://github.com/MikeMcl/big.js/LICENCE |
| | | */ |
| | | (function (GLOBAL) { |
| | | "use strict"; |
| | | var Big, |
| | | /************************************** EDITABLE DEFAULTS *****************************************/ |
| | | |
| | | // The default values below must be integers within the stated ranges. |
| | | |
| | | /* |
| | | * The maximum number of decimal places (DP) of the results of operations involving division: |
| | | * div and sqrt, and pow with negative exponents. |
| | | */ |
| | | DP = 20, // 0 to MAX_DP |
| | | /* |
| | | * The rounding mode (RM) used when rounding to the above decimal places. |
| | | * |
| | | * 0 Towards zero (i.e. truncate, no rounding). (ROUND_DOWN) |
| | | * 1 To nearest neighbour. If equidistant, round up. (ROUND_HALF_UP) |
| | | * 2 To nearest neighbour. If equidistant, to even. (ROUND_HALF_EVEN) |
| | | * 3 Away from zero. (ROUND_UP) |
| | | */ |
| | | RM = 1, // 0, 1, 2 or 3 |
| | | // The maximum value of DP and Big.DP. |
| | | MAX_DP = 1e6, // 0 to 1000000 |
| | | // The maximum magnitude of the exponent argument to the pow method. |
| | | MAX_POWER = 1e6, // 1 to 1000000 |
| | | /* |
| | | * The negative exponent (NE) at and beneath which toString returns exponential notation. |
| | | * (JavaScript numbers: -7) |
| | | * -1000000 is the minimum recommended exponent value of a Big. |
| | | */ |
| | | NE = -7, // 0 to -1000000 |
| | | /* |
| | | * The positive exponent (PE) at and above which toString returns exponential notation. |
| | | * (JavaScript numbers: 21) |
| | | * 1000000 is the maximum recommended exponent value of a Big. |
| | | * (This limit is not enforced or checked.) |
| | | */ |
| | | PE = 21, // 0 to 1000000 |
| | | /**************************************************************************************************/ |
| | | |
| | | // Error messages. |
| | | NAME = "[big.js] ", |
| | | INVALID = NAME + "Invalid ", |
| | | INVALID_DP = INVALID + "decimal places", |
| | | INVALID_RM = INVALID + "rounding mode", |
| | | DIV_BY_ZERO = NAME + "Division by zero", |
| | | // The shared prototype object. |
| | | P = {}, |
| | | UNDEFINED = void 0, |
| | | NUMERIC = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i; |
| | | |
| | | /* |
| | | * Create and return a Big constructor. |
| | | * |
| | | */ |
| | | function _Big_() { |
| | | /* |
| | | * The Big constructor and exported function. |
| | | * Create and return a new instance of a Big number object. |
| | | * |
| | | * n {number|string|Big} A numeric value. |
| | | */ |
| | | function Big(n) { |
| | | var x = this; |
| | | |
| | | // Enable constructor usage without new. |
| | | if (!(x instanceof Big)) return n === UNDEFINED ? _Big_() : new Big(n); |
| | | |
| | | // Duplicate. |
| | | if (n instanceof Big) { |
| | | x.s = n.s; |
| | | x.e = n.e; |
| | | x.c = n.c.slice(); |
| | | } else { |
| | | parse(x, n); |
| | | } |
| | | |
| | | /* |
| | | * Retain a reference to this Big constructor, and shadow Big.prototype.constructor which |
| | | * points to Object. |
| | | */ |
| | | x.constructor = Big; |
| | | } |
| | | |
| | | Big.prototype = P; |
| | | Big.DP = DP; |
| | | Big.RM = RM; |
| | | Big.NE = NE; |
| | | Big.PE = PE; |
| | | Big.version = "5.2.2"; |
| | | |
| | | return Big; |
| | | } |
| | | |
| | | /* |
| | | * Parse the number or string value passed to a Big constructor. |
| | | * |
| | | * x {Big} A Big number instance. |
| | | * n {number|string} A numeric value. |
| | | */ |
| | | function parse(x, n) { |
| | | var e, i, nl; |
| | | |
| | | // Minus zero? |
| | | if (n === 0 && 1 / n < 0) n = "-0"; |
| | | else if (!NUMERIC.test((n += ""))) throw Error(INVALID + "number"); |
| | | |
| | | // Determine sign. |
| | | x.s = n.charAt(0) == "-" ? ((n = n.slice(1)), -1) : 1; |
| | | |
| | | // Decimal point? |
| | | if ((e = n.indexOf(".")) > -1) n = n.replace(".", ""); |
| | | |
| | | // Exponential form? |
| | | if ((i = n.search(/e/i)) > 0) { |
| | | // Determine exponent. |
| | | if (e < 0) e = i; |
| | | e += +n.slice(i + 1); |
| | | n = n.substring(0, i); |
| | | } else if (e < 0) { |
| | | // Integer. |
| | | e = n.length; |
| | | } |
| | | |
| | | nl = n.length; |
| | | |
| | | // Determine leading zeros. |
| | | for (i = 0; i < nl && n.charAt(i) == "0"; ) ++i; |
| | | |
| | | if (i == nl) { |
| | | // Zero. |
| | | x.c = [(x.e = 0)]; |
| | | } else { |
| | | // Determine trailing zeros. |
| | | for (; nl > 0 && n.charAt(--nl) == "0"; ); |
| | | x.e = e - i - 1; |
| | | x.c = []; |
| | | |
| | | // Convert string to array of digits without leading/trailing zeros. |
| | | for (e = 0; i <= nl; ) x.c[e++] = +n.charAt(i++); |
| | | } |
| | | |
| | | return x; |
| | | } |
| | | |
| | | /* |
| | | * Round Big x to a maximum of dp decimal places using rounding mode rm. |
| | | * Called by stringify, P.div, P.round and P.sqrt. |
| | | * |
| | | * x {Big} The Big to round. |
| | | * dp {number} Integer, 0 to MAX_DP inclusive. |
| | | * rm {number} 0, 1, 2 or 3 (DOWN, HALF_UP, HALF_EVEN, UP) |
| | | * [more] {boolean} Whether the result of division was truncated. |
| | | */ |
| | | function round(x, dp, rm, more) { |
| | | var xc = x.c, |
| | | i = x.e + dp + 1; |
| | | |
| | | if (i < xc.length) { |
| | | if (rm === 1) { |
| | | // xc[i] is the digit after the digit that may be rounded up. |
| | | more = xc[i] >= 5; |
| | | } else if (rm === 2) { |
| | | more = |
| | | xc[i] > 5 || |
| | | (xc[i] == 5 && |
| | | (more || i < 0 || xc[i + 1] !== UNDEFINED || xc[i - 1] & 1)); |
| | | } else if (rm === 3) { |
| | | more = more || !!xc[0]; |
| | | } else { |
| | | more = false; |
| | | if (rm !== 0) throw Error(INVALID_RM); |
| | | } |
| | | |
| | | if (i < 1) { |
| | | xc.length = 1; |
| | | |
| | | if (more) { |
| | | // 1, 0.1, 0.01, 0.001, 0.0001 etc. |
| | | x.e = -dp; |
| | | xc[0] = 1; |
| | | } else { |
| | | // Zero. |
| | | xc[0] = x.e = 0; |
| | | } |
| | | } else { |
| | | // Remove any digits after the required decimal places. |
| | | xc.length = i--; |
| | | |
| | | // Round up? |
| | | if (more) { |
| | | // Rounding up may mean the previous digit has to be rounded up. |
| | | for (; ++xc[i] > 9; ) { |
| | | xc[i] = 0; |
| | | if (!i--) { |
| | | ++x.e; |
| | | xc.unshift(1); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // Remove trailing zeros. |
| | | for (i = xc.length; !xc[--i]; ) xc.pop(); |
| | | } |
| | | } else if (rm < 0 || rm > 3 || rm !== ~~rm) { |
| | | throw Error(INVALID_RM); |
| | | } |
| | | |
| | | return x; |
| | | } |
| | | |
| | | /* |
| | | * Return a string representing the value of Big x in normal or exponential notation. |
| | | * Handles P.toExponential, P.toFixed, P.toJSON, P.toPrecision, P.toString and P.valueOf. |
| | | * |
| | | * x {Big} |
| | | * id? {number} Caller id. |
| | | * 1 toExponential |
| | | * 2 toFixed |
| | | * 3 toPrecision |
| | | * 4 valueOf |
| | | * n? {number|undefined} Caller's argument. |
| | | * k? {number|undefined} |
| | | */ |
| | | function stringify(x, id, n, k) { |
| | | var e, |
| | | s, |
| | | Big = x.constructor, |
| | | z = !x.c[0]; |
| | | |
| | | if (n !== UNDEFINED) { |
| | | if (n !== ~~n || n < (id == 3) || n > MAX_DP) { |
| | | throw Error(id == 3 ? INVALID + "precision" : INVALID_DP); |
| | | } |
| | | |
| | | x = new Big(x); |
| | | |
| | | // The index of the digit that may be rounded up. |
| | | n = k - x.e; |
| | | |
| | | // Round? |
| | | if (x.c.length > ++k) round(x, n, Big.RM); |
| | | |
| | | // toFixed: recalculate k as x.e may have changed if value rounded up. |
| | | if (id == 2) k = x.e + n + 1; |
| | | |
| | | // Append zeros? |
| | | for (; x.c.length < k; ) x.c.push(0); |
| | | } |
| | | |
| | | e = x.e; |
| | | s = x.c.join(""); |
| | | n = s.length; |
| | | |
| | | // Exponential notation? |
| | | if ( |
| | | id != 2 && |
| | | (id == 1 || (id == 3 && k <= e) || e <= Big.NE || e >= Big.PE) |
| | | ) { |
| | | s = |
| | | s.charAt(0) + |
| | | (n > 1 ? "." + s.slice(1) : "") + |
| | | (e < 0 ? "e" : "e+") + |
| | | e; |
| | | |
| | | // Normal notation. |
| | | } else if (e < 0) { |
| | | for (; ++e; ) s = "0" + s; |
| | | s = "0." + s; |
| | | } else if (e > 0) { |
| | | if (++e > n) for (e -= n; e--; ) s += "0"; |
| | | else if (e < n) s = s.slice(0, e) + "." + s.slice(e); |
| | | } else if (n > 1) { |
| | | s = s.charAt(0) + "." + s.slice(1); |
| | | } |
| | | |
| | | return x.s < 0 && (!z || id == 4) ? "-" + s : s; |
| | | } |
| | | |
| | | // Prototype/instance methods |
| | | |
| | | /* |
| | | * Return a new Big whose value is the absolute value of this Big. |
| | | */ |
| | | P.abs = function () { |
| | | var x = new this.constructor(this); |
| | | x.s = 1; |
| | | return x; |
| | | }; |
| | | |
| | | /* |
| | | * Return 1 if the value of this Big is greater than the value of Big y, |
| | | * -1 if the value of this Big is less than the value of Big y, or |
| | | * 0 if they have the same value. |
| | | */ |
| | | P.cmp = function (y) { |
| | | var isneg, |
| | | x = this, |
| | | xc = x.c, |
| | | yc = (y = new x.constructor(y)).c, |
| | | i = x.s, |
| | | j = y.s, |
| | | k = x.e, |
| | | l = y.e; |
| | | |
| | | // Either zero? |
| | | if (!xc[0] || !yc[0]) return !xc[0] ? (!yc[0] ? 0 : -j) : i; |
| | | |
| | | // Signs differ? |
| | | if (i != j) return i; |
| | | |
| | | isneg = i < 0; |
| | | |
| | | // Compare exponents. |
| | | if (k != l) return (k > l) ^ isneg ? 1 : -1; |
| | | |
| | | j = (k = xc.length) < (l = yc.length) ? k : l; |
| | | |
| | | // Compare digit by digit. |
| | | for (i = -1; ++i < j; ) { |
| | | if (xc[i] != yc[i]) return (xc[i] > yc[i]) ^ isneg ? 1 : -1; |
| | | } |
| | | |
| | | // Compare lengths. |
| | | return k == l ? 0 : (k > l) ^ isneg ? 1 : -1; |
| | | }; |
| | | |
| | | /* |
| | | * Return a new Big whose value is the value of this Big divided by the value of Big y, rounded, |
| | | * if necessary, to a maximum of Big.DP decimal places using rounding mode Big.RM. |
| | | */ |
| | | P.div = function (y) { |
| | | var x = this, |
| | | Big = x.constructor, |
| | | a = x.c, // dividend |
| | | b = (y = new Big(y)).c, // divisor |
| | | k = x.s == y.s ? 1 : -1, |
| | | dp = Big.DP; |
| | | |
| | | if (dp !== ~~dp || dp < 0 || dp > MAX_DP) throw Error(INVALID_DP); |
| | | |
| | | // Divisor is zero? |
| | | if (!b[0]) throw Error(DIV_BY_ZERO); |
| | | |
| | | // Dividend is 0? Return +-0. |
| | | if (!a[0]) return new Big(k * 0); |
| | | |
| | | var bl, |
| | | bt, |
| | | n, |
| | | cmp, |
| | | ri, |
| | | bz = b.slice(), |
| | | ai = (bl = b.length), |
| | | al = a.length, |
| | | r = a.slice(0, bl), // remainder |
| | | rl = r.length, |
| | | q = y, // quotient |
| | | qc = (q.c = []), |
| | | qi = 0, |
| | | d = dp + (q.e = x.e - y.e) + 1; // number of digits of the result |
| | | |
| | | q.s = k; |
| | | k = d < 0 ? 0 : d; |
| | | |
| | | // Create version of divisor with leading zero. |
| | | bz.unshift(0); |
| | | |
| | | // CommunicateAdd zeros to make remainder as long as divisor. |
| | | for (; rl++ < bl; ) r.push(0); |
| | | |
| | | do { |
| | | // n is how many times the divisor goes into current remainder. |
| | | for (n = 0; n < 10; n++) { |
| | | // Compare divisor and remainder. |
| | | if (bl != (rl = r.length)) { |
| | | cmp = bl > rl ? 1 : -1; |
| | | } else { |
| | | for (ri = -1, cmp = 0; ++ri < bl; ) { |
| | | if (b[ri] != r[ri]) { |
| | | cmp = b[ri] > r[ri] ? 1 : -1; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | // If divisor < remainder, subtract divisor from remainder. |
| | | if (cmp < 0) { |
| | | // Remainder can't be more than 1 digit longer than divisor. |
| | | // Equalise lengths using divisor with extra leading zero? |
| | | for (bt = rl == bl ? b : bz; rl; ) { |
| | | if (r[--rl] < bt[rl]) { |
| | | ri = rl; |
| | | for (; ri && !r[--ri]; ) r[ri] = 9; |
| | | --r[ri]; |
| | | r[rl] += 10; |
| | | } |
| | | r[rl] -= bt[rl]; |
| | | } |
| | | |
| | | for (; !r[0]; ) r.shift(); |
| | | } else { |
| | | break; |
| | | } |
| | | } |
| | | |
| | | // CommunicateAdd the digit n to the result array. |
| | | qc[qi++] = cmp ? n : ++n; |
| | | |
| | | // Update the remainder. |
| | | if (r[0] && cmp) r[rl] = a[ai] || 0; |
| | | else r = [a[ai]]; |
| | | } while ((ai++ < al || r[0] !== UNDEFINED) && k--); |
| | | |
| | | // Leading zero? Do not remove if result is simply zero (qi == 1). |
| | | if (!qc[0] && qi != 1) { |
| | | // There can't be more than one zero. |
| | | qc.shift(); |
| | | q.e--; |
| | | } |
| | | |
| | | // Round? |
| | | if (qi > d) round(q, dp, Big.RM, r[0] !== UNDEFINED); |
| | | |
| | | return q; |
| | | }; |
| | | |
| | | /* |
| | | * Return true if the value of this Big is equal to the value of Big y, otherwise return false. |
| | | */ |
| | | P.eq = function (y) { |
| | | return !this.cmp(y); |
| | | }; |
| | | |
| | | /* |
| | | * Return true if the value of this Big is greater than the value of Big y, otherwise return |
| | | * false. |
| | | */ |
| | | P.gt = function (y) { |
| | | return this.cmp(y) > 0; |
| | | }; |
| | | |
| | | /* |
| | | * Return true if the value of this Big is greater than or equal to the value of Big y, otherwise |
| | | * return false. |
| | | */ |
| | | P.gte = function (y) { |
| | | return this.cmp(y) > -1; |
| | | }; |
| | | |
| | | /* |
| | | * Return true if the value of this Big is less than the value of Big y, otherwise return false. |
| | | */ |
| | | P.lt = function (y) { |
| | | return this.cmp(y) < 0; |
| | | }; |
| | | |
| | | /* |
| | | * Return true if the value of this Big is less than or equal to the value of Big y, otherwise |
| | | * return false. |
| | | */ |
| | | P.lte = function (y) { |
| | | return this.cmp(y) < 1; |
| | | }; |
| | | |
| | | /* |
| | | * Return a new Big whose value is the value of this Big minus the value of Big y. |
| | | */ |
| | | P.minus = P.sub = function (y) { |
| | | var i, |
| | | j, |
| | | t, |
| | | xlty, |
| | | x = this, |
| | | Big = x.constructor, |
| | | a = x.s, |
| | | b = (y = new Big(y)).s; |
| | | |
| | | // Signs differ? |
| | | if (a != b) { |
| | | y.s = -b; |
| | | return x.plus(y); |
| | | } |
| | | |
| | | var xc = x.c.slice(), |
| | | xe = x.e, |
| | | yc = y.c, |
| | | ye = y.e; |
| | | |
| | | // Either zero? |
| | | if (!xc[0] || !yc[0]) { |
| | | // y is non-zero? x is non-zero? Or both are zero. |
| | | return yc[0] ? ((y.s = -b), y) : new Big(xc[0] ? x : 0); |
| | | } |
| | | |
| | | // Determine which is the bigger number. Prepend zeros to equalise exponents. |
| | | if ((a = xe - ye)) { |
| | | if ((xlty = a < 0)) { |
| | | a = -a; |
| | | t = xc; |
| | | } else { |
| | | ye = xe; |
| | | t = yc; |
| | | } |
| | | |
| | | t.reverse(); |
| | | for (b = a; b--; ) t.push(0); |
| | | t.reverse(); |
| | | } else { |
| | | // Exponents equal. Check digit by digit. |
| | | j = ((xlty = xc.length < yc.length) ? xc : yc).length; |
| | | |
| | | for (a = b = 0; b < j; b++) { |
| | | if (xc[b] != yc[b]) { |
| | | xlty = xc[b] < yc[b]; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | // x < y? Point xc to the array of the bigger number. |
| | | if (xlty) { |
| | | t = xc; |
| | | xc = yc; |
| | | yc = t; |
| | | y.s = -y.s; |
| | | } |
| | | |
| | | /* |
| | | * Append zeros to xc if shorter. No need to add zeros to yc if shorter as subtraction only |
| | | * needs to start at yc.length. |
| | | */ |
| | | if ((b = (j = yc.length) - (i = xc.length)) > 0) for (; b--; ) xc[i++] = 0; |
| | | |
| | | // Subtract yc from xc. |
| | | for (b = i; j > a; ) { |
| | | if (xc[--j] < yc[j]) { |
| | | for (i = j; i && !xc[--i]; ) xc[i] = 9; |
| | | --xc[i]; |
| | | xc[j] += 10; |
| | | } |
| | | |
| | | xc[j] -= yc[j]; |
| | | } |
| | | |
| | | // Remove trailing zeros. |
| | | for (; xc[--b] === 0; ) xc.pop(); |
| | | |
| | | // Remove leading zeros and adjust exponent accordingly. |
| | | for (; xc[0] === 0; ) { |
| | | xc.shift(); |
| | | --ye; |
| | | } |
| | | |
| | | if (!xc[0]) { |
| | | // n - n = +0 |
| | | y.s = 1; |
| | | |
| | | // Result must be zero. |
| | | xc = [(ye = 0)]; |
| | | } |
| | | |
| | | y.c = xc; |
| | | y.e = ye; |
| | | |
| | | return y; |
| | | }; |
| | | |
| | | /* |
| | | * Return a new Big whose value is the value of this Big modulo the value of Big y. |
| | | */ |
| | | P.mod = function (y) { |
| | | var ygtx, |
| | | x = this, |
| | | Big = x.constructor, |
| | | a = x.s, |
| | | b = (y = new Big(y)).s; |
| | | |
| | | if (!y.c[0]) throw Error(DIV_BY_ZERO); |
| | | |
| | | x.s = y.s = 1; |
| | | ygtx = y.cmp(x) == 1; |
| | | x.s = a; |
| | | y.s = b; |
| | | |
| | | if (ygtx) return new Big(x); |
| | | |
| | | a = Big.DP; |
| | | b = Big.RM; |
| | | Big.DP = Big.RM = 0; |
| | | x = x.div(y); |
| | | Big.DP = a; |
| | | Big.RM = b; |
| | | |
| | | return this.minus(x.times(y)); |
| | | }; |
| | | |
| | | /* |
| | | * Return a new Big whose value is the value of this Big plus the value of Big y. |
| | | */ |
| | | P.plus = P.add = function (y) { |
| | | var t, |
| | | x = this, |
| | | Big = x.constructor, |
| | | a = x.s, |
| | | b = (y = new Big(y)).s; |
| | | |
| | | // Signs differ? |
| | | if (a != b) { |
| | | y.s = -b; |
| | | return x.minus(y); |
| | | } |
| | | |
| | | var xe = x.e, |
| | | xc = x.c, |
| | | ye = y.e, |
| | | yc = y.c; |
| | | |
| | | // Either zero? y is non-zero? x is non-zero? Or both are zero. |
| | | if (!xc[0] || !yc[0]) return yc[0] ? y : new Big(xc[0] ? x : a * 0); |
| | | |
| | | xc = xc.slice(); |
| | | |
| | | // Prepend zeros to equalise exponents. |
| | | // Note: reverse faster than unshifts. |
| | | if ((a = xe - ye)) { |
| | | if (a > 0) { |
| | | ye = xe; |
| | | t = yc; |
| | | } else { |
| | | a = -a; |
| | | t = xc; |
| | | } |
| | | |
| | | t.reverse(); |
| | | for (; a--; ) t.push(0); |
| | | t.reverse(); |
| | | } |
| | | |
| | | // Point xc to the longer array. |
| | | if (xc.length - yc.length < 0) { |
| | | t = yc; |
| | | yc = xc; |
| | | xc = t; |
| | | } |
| | | |
| | | a = yc.length; |
| | | |
| | | // Only start adding at yc.length - 1 as the further digits of xc can be left as they are. |
| | | for (b = 0; a; xc[a] %= 10) b = ((xc[--a] = xc[a] + yc[a] + b) / 10) | 0; |
| | | |
| | | // No need to check for zero, as +x + +y != 0 && -x + -y != 0 |
| | | |
| | | if (b) { |
| | | xc.unshift(b); |
| | | ++ye; |
| | | } |
| | | |
| | | // Remove trailing zeros. |
| | | for (a = xc.length; xc[--a] === 0; ) xc.pop(); |
| | | |
| | | y.c = xc; |
| | | y.e = ye; |
| | | |
| | | return y; |
| | | }; |
| | | |
| | | /* |
| | | * Return a Big whose value is the value of this Big raised to the power n. |
| | | * If n is negative, round to a maximum of Big.DP decimal places using rounding |
| | | * mode Big.RM. |
| | | * |
| | | * n {number} Integer, -MAX_POWER to MAX_POWER inclusive. |
| | | */ |
| | | P.pow = function (n) { |
| | | var x = this, |
| | | one = new x.constructor(1), |
| | | y = one, |
| | | isneg = n < 0; |
| | | |
| | | if (n !== ~~n || n < -MAX_POWER || n > MAX_POWER) |
| | | throw Error(INVALID + "exponent"); |
| | | if (isneg) n = -n; |
| | | |
| | | for (;;) { |
| | | if (n & 1) y = y.times(x); |
| | | n >>= 1; |
| | | if (!n) break; |
| | | x = x.times(x); |
| | | } |
| | | |
| | | return isneg ? one.div(y) : y; |
| | | }; |
| | | |
| | | /* |
| | | * Return a new Big whose value is the value of this Big rounded using rounding mode rm |
| | | * to a maximum of dp decimal places, or, if dp is negative, to an integer which is a |
| | | * multiple of 10**-dp. |
| | | * If dp is not specified, round to 0 decimal places. |
| | | * If rm is not specified, use Big.RM. |
| | | * |
| | | * dp? {number} Integer, -MAX_DP to MAX_DP inclusive. |
| | | * rm? 0, 1, 2 or 3 (ROUND_DOWN, ROUND_HALF_UP, ROUND_HALF_EVEN, ROUND_UP) |
| | | */ |
| | | P.round = function (dp, rm) { |
| | | var Big = this.constructor; |
| | | if (dp === UNDEFINED) dp = 0; |
| | | else if (dp !== ~~dp || dp < -MAX_DP || dp > MAX_DP) |
| | | throw Error(INVALID_DP); |
| | | return round(new Big(this), dp, rm === UNDEFINED ? Big.RM : rm); |
| | | }; |
| | | |
| | | /* |
| | | * Return a new Big whose value is the square root of the value of this Big, rounded, if |
| | | * necessary, to a maximum of Big.DP decimal places using rounding mode Big.RM. |
| | | */ |
| | | P.sqrt = function () { |
| | | var r, |
| | | c, |
| | | t, |
| | | x = this, |
| | | Big = x.constructor, |
| | | s = x.s, |
| | | e = x.e, |
| | | half = new Big(0.5); |
| | | |
| | | // Zero? |
| | | if (!x.c[0]) return new Big(x); |
| | | |
| | | // Negative? |
| | | if (s < 0) throw Error(NAME + "No square root"); |
| | | |
| | | // Estimate. |
| | | s = Math.sqrt(x + ""); |
| | | |
| | | // Math.sqrt underflow/overflow? |
| | | // Re-estimate: pass x coefficient to Math.sqrt as integer, then adjust the result exponent. |
| | | if (s === 0 || s === 1 / 0) { |
| | | c = x.c.join(""); |
| | | if (!((c.length + e) & 1)) c += "0"; |
| | | s = Math.sqrt(c); |
| | | e = (((e + 1) / 2) | 0) - (e < 0 || e & 1); |
| | | r = new Big( |
| | | (s == 1 / 0 |
| | | ? "1e" |
| | | : (s = s.toExponential()).slice(0, s.indexOf("e") + 1)) + e |
| | | ); |
| | | } else { |
| | | r = new Big(s); |
| | | } |
| | | |
| | | e = r.e + (Big.DP += 4); |
| | | |
| | | // Newton-Raphson iteration. |
| | | do { |
| | | t = r; |
| | | r = half.times(t.plus(x.div(t))); |
| | | } while (t.c.slice(0, e).join("") !== r.c.slice(0, e).join("")); |
| | | |
| | | return round(r, (Big.DP -= 4), Big.RM); |
| | | }; |
| | | |
| | | /* |
| | | * Return a new Big whose value is the value of this Big times the value of Big y. |
| | | */ |
| | | P.times = P.mul = function (y) { |
| | | var c, |
| | | x = this, |
| | | Big = x.constructor, |
| | | xc = x.c, |
| | | yc = (y = new Big(y)).c, |
| | | a = xc.length, |
| | | b = yc.length, |
| | | i = x.e, |
| | | j = y.e; |
| | | |
| | | // Determine sign of result. |
| | | y.s = x.s == y.s ? 1 : -1; |
| | | |
| | | // Return signed 0 if either 0. |
| | | if (!xc[0] || !yc[0]) return new Big(y.s * 0); |
| | | |
| | | // Initialise exponent of result as x.e + y.e. |
| | | y.e = i + j; |
| | | |
| | | // If array xc has fewer digits than yc, swap xc and yc, and lengths. |
| | | if (a < b) { |
| | | c = xc; |
| | | xc = yc; |
| | | yc = c; |
| | | j = a; |
| | | a = b; |
| | | b = j; |
| | | } |
| | | |
| | | // Initialise coefficient array of result with zeros. |
| | | for (c = new Array((j = a + b)); j--; ) c[j] = 0; |
| | | |
| | | // Multiply. |
| | | |
| | | // i is initially xc.length. |
| | | for (i = b; i--; ) { |
| | | b = 0; |
| | | |
| | | // a is yc.length. |
| | | for (j = a + i; j > i; ) { |
| | | // Current sum of products at this digit position, plus carry. |
| | | b = c[j] + yc[i] * xc[j - i - 1] + b; |
| | | c[j--] = b % 10; |
| | | |
| | | // carry |
| | | b = (b / 10) | 0; |
| | | } |
| | | |
| | | c[j] = (c[j] + b) % 10; |
| | | } |
| | | |
| | | // Increment result exponent if there is a final carry, otherwise remove leading zero. |
| | | if (b) ++y.e; |
| | | else c.shift(); |
| | | |
| | | // Remove trailing zeros. |
| | | for (i = c.length; !c[--i]; ) c.pop(); |
| | | y.c = c; |
| | | |
| | | return y; |
| | | }; |
| | | |
| | | /* |
| | | * Return a string representing the value of this Big in exponential notation to dp fixed decimal |
| | | * places and rounded using Big.RM. |
| | | * |
| | | * dp? {number} Integer, 0 to MAX_DP inclusive. |
| | | */ |
| | | P.toExponential = function (dp) { |
| | | return stringify(this, 1, dp, dp); |
| | | }; |
| | | |
| | | /* |
| | | * Return a string representing the value of this Big in normal notation to dp fixed decimal |
| | | * places and rounded using Big.RM. |
| | | * |
| | | * dp? {number} Integer, 0 to MAX_DP inclusive. |
| | | * |
| | | * (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'. |
| | | * (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'. |
| | | */ |
| | | P.toFixed = function (dp) { |
| | | return stringify(this, 2, dp, this.e + dp); |
| | | }; |
| | | |
| | | /* |
| | | * Return a string representing the value of this Big rounded to sd significant digits using |
| | | * Big.RM. Use exponential notation if sd is less than the number of digits necessary to represent |
| | | * the integer part of the value in normal notation. |
| | | * |
| | | * sd {number} Integer, 1 to MAX_DP inclusive. |
| | | */ |
| | | P.toPrecision = function (sd) { |
| | | return stringify(this, 3, sd, sd - 1); |
| | | }; |
| | | |
| | | /* |
| | | * Return a string representing the value of this Big. |
| | | * Return exponential notation if this Big has a positive exponent equal to or greater than |
| | | * Big.PE, or a negative exponent equal to or less than Big.NE. |
| | | * Omit the sign for negative zero. |
| | | */ |
| | | P.toString = function () { |
| | | return stringify(this); |
| | | }; |
| | | |
| | | /* |
| | | * Return a string representing the value of this Big. |
| | | * Return exponential notation if this Big has a positive exponent equal to or greater than |
| | | * Big.PE, or a negative exponent equal to or less than Big.NE. |
| | | * Include the sign for negative zero. |
| | | */ |
| | | P.valueOf = P.toJSON = function () { |
| | | return stringify(this, 4); |
| | | }; |
| | | |
| | | // Export |
| | | |
| | | Big = _Big_(); |
| | | |
| | | Big["default"] = Big.Big = Big; |
| | | |
| | | //AMD. |
| | | if (typeof define === "function" && define.amd) { |
| | | define(function () { |
| | | return Big; |
| | | }); |
| | | |
| | | // Node and other CommonJS-like environments that support module.exports. |
| | | } else if (typeof module !== "undefined" && module.exports) { |
| | | module.exports = Big; |
| | | |
| | | //Browser. |
| | | } else { |
| | | GLOBAL.Big = Big; |
| | | } |
| | | })(this); |