| | |
| | | max: 1000, |
| | | msg: '取值范围0~1000' |
| | | }, |
| | | // 单体节数 1-500 |
| | | battCount: { |
| | | pattern: /^[0-9]{1,3}$/, |
| | | regVal: true, |
| | | min: 1, |
| | | max: 500, |
| | | msg: '取值范围1~500' |
| | | } |
| | | } |
| | | }; |
| | |
| | | ], |
| | | battCount: [ |
| | | { required: true, message: "请输入电池数量", trigger: "blur" }, |
| | | { |
| | | validator(rule, value, callback) { |
| | | testVal(rule, value, callback, O_rules.battCount); |
| | | }, |
| | | trigger: ["change", "blur"], |
| | | }, |
| | | ], |
| | | battCap: [ |
| | | { required: true, message: "请输入标称容量", trigger: "blur" }, |
| | |
| | | <el-option label="12V" :value="12"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="属性"> |
| | | <el-select v-model="propType"> |
| | | <el-option label="内阻" value="res"></el-option> |
| | | <el-option label="电压" value="vol"></el-option> |
| | | <el-option label="电导" value="cond"></el-option> |
| | | <el-option label="连接条" value="chain"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="评价"> |
| | | <el-select v-model="estimate"> |
| | | <el-option label="全部" :value="0"></el-option> |
| | |
| | | </el-form-item> |
| | | </el-form> |
| | | <div class="btn-grp"> |
| | | <el-button size="mini" type="primary" class="btn" @click="getDatas">查询</el-button> |
| | | <el-button size="mini" type="primary" class="btn" @click="getDatas" |
| | | >查询</el-button |
| | | > |
| | | <el-popconfirm |
| | | class="btn" |
| | | title="导入操作将覆盖数据库记录,确定导入吗?" |
| | | @confirm="dbImport" |
| | | > |
| | | <el-button |
| | | slot="reference" |
| | | size="mini" |
| | | type="primary" |
| | | <el-button slot="reference" size="mini" type="primary" |
| | | >导入</el-button |
| | | > |
| | | </el-popconfirm> |
| | | <el-button size="mini" class="btn" type="primary" @click="dbExport">导出</el-button> |
| | | <el-button size="mini" class="btn" type="primary" @click="dbExport" |
| | | >导出</el-button |
| | | > |
| | | </div> |
| | | </div> |
| | | <div class="table-wrap"> |
| | |
| | | return { |
| | | // 当前页面最大单体数 |
| | | maxCount: 0, |
| | | propType: 'res', |
| | | tableData: [], |
| | | header0, |
| | | pageCurr: 1, |
| | |
| | | }, |
| | | computed: { |
| | | headers() { |
| | | let header_res = [], |
| | | header_vol = [], |
| | | header_cond = [], |
| | | header_chain = []; |
| | | const arr = []; |
| | | for (let i = 0, j = this.maxCount; i < j; i++) { |
| | | let idx = i + 1; |
| | | header_res.push({ |
| | | prop: "res" + idx, |
| | | label: `#${idx}内阻`, |
| | | minWidth: 100, |
| | | }); |
| | | header_vol.push({ |
| | | prop: "vol" + idx, |
| | | label: `#${idx}电压`, |
| | | minWidth: 100, |
| | | }); |
| | | header_cond.push({ |
| | | prop: "cond" + idx, |
| | | label: `#${idx}电导`, |
| | | minWidth: 100, |
| | | }); |
| | | header_chain.push({ |
| | | prop: "chain" + idx, |
| | | label: `#${idx}连接条`, |
| | | minWidth: 100, |
| | | }); |
| | | switch (this.propType) { |
| | | case "res": |
| | | arr.push({ |
| | | prop: "res" + idx, |
| | | label: `#${idx}内阻`, |
| | | minWidth: 100, |
| | | }); |
| | | break; |
| | | case "vol": |
| | | arr.push({ |
| | | prop: "vol" + idx, |
| | | label: `#${idx}电压`, |
| | | minWidth: 100, |
| | | }); |
| | | break; |
| | | case "cond": |
| | | arr.push({ |
| | | prop: "cond" + idx, |
| | | label: `#${idx}电导`, |
| | | minWidth: 100, |
| | | }); |
| | | break; |
| | | case "chain": |
| | | arr.push({ |
| | | prop: "chain" + idx, |
| | | label: `#${idx}连接条`, |
| | | minWidth: 100, |
| | | }); |
| | | break; |
| | | } |
| | | } |
| | | return [ |
| | | ...this.header0, |
| | | ...header_res, |
| | | ...header_vol, |
| | | ...header_cond, |
| | | ...header_chain, |
| | | ...arr |
| | | ]; |
| | | }, |
| | | }, |
| | |
| | | }, |
| | | // 数据库导入 |
| | | dbImport() { |
| | | this.$bus.$emit("loading", '请不要关闭程序, 等待程序自动重启'); |
| | | this.$bus.$emit("loading", "请不要关闭程序, 等待程序自动重启"); |
| | | window.api.send("db-import"); |
| | | }, |
| | | // 数据库导出 |
| | |
| | | display: flex; |
| | | .btn-grp { |
| | | margin-left: 0.4em; |
| | | .btn{ |
| | | .btn { |
| | | display: inline-block; |
| | | & + .btn { |
| | | margin-left: 4px; |