|
@@ -12,19 +12,15 @@
|
|
clearable
|
|
clearable
|
|
placeholder="请选择"
|
|
placeholder="请选择"
|
|
>
|
|
>
|
|
- <el-option
|
|
|
|
- v-for="dict in deviceTypeOptions"
|
|
|
|
- :key="dict.dictValue"
|
|
|
|
- :label="dict.dictLabel"
|
|
|
|
- :value="dict.dictValue"
|
|
|
|
- ></el-option>
|
|
|
|
|
|
+ <el-option label="小票打印机" value="1"></el-option>
|
|
|
|
+ <el-option label="POS" value="2"></el-option>
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
|
- <el-form-item label="设备序列号" prop="deviceSerialNum">
|
|
|
|
|
|
+ <el-form-item label="密钥" prop="deviceSerialNum">
|
|
<el-input
|
|
<el-input
|
|
v-model="queryForm.deviceSerialNum"
|
|
v-model="queryForm.deviceSerialNum"
|
|
- placeholder="请输入设备序列号"
|
|
|
|
|
|
+ placeholder="请输入设备密钥"
|
|
clearable
|
|
clearable
|
|
size="small"
|
|
size="small"
|
|
@keyup.enter.native="handleQuery"
|
|
@keyup.enter.native="handleQuery"
|
|
@@ -57,44 +53,47 @@
|
|
</el-form>
|
|
</el-form>
|
|
|
|
|
|
<el-table :data="equipmentList">
|
|
<el-table :data="equipmentList">
|
|
- <el-table-column
|
|
|
|
|
|
+ <af-table-column
|
|
label="主键自增id"
|
|
label="主键自增id"
|
|
v-if="false"
|
|
v-if="false"
|
|
align="center"
|
|
align="center"
|
|
prop="deviceId"
|
|
prop="deviceId"
|
|
/>
|
|
/>
|
|
- <el-table-column
|
|
|
|
|
|
+ <af-table-column
|
|
label="油站名称"
|
|
label="油站名称"
|
|
align="center"
|
|
align="center"
|
|
prop="stationName"
|
|
prop="stationName"
|
|
- v-if="jiBie === 3"
|
|
|
|
|
|
+ v-if="jiBie !== 2"
|
|
/>
|
|
/>
|
|
- <el-table-column
|
|
|
|
- label="设备编号"
|
|
|
|
- align="center"
|
|
|
|
- prop="deviceNo"
|
|
|
|
- />
|
|
|
|
- <el-table-column
|
|
|
|
- label="设备序列号"
|
|
|
|
- align="center"
|
|
|
|
- prop="deviceSerialNum"
|
|
|
|
- />
|
|
|
|
-
|
|
|
|
- <el-table-column label="设备厂家" align="center" prop="deviceFactory" />
|
|
|
|
- <el-table-column label="绑定油枪号" align="center" prop="gunNo" />
|
|
|
|
- <el-table-column
|
|
|
|
- label="启动状态"
|
|
|
|
- align="center"
|
|
|
|
- prop="deviceStatus"
|
|
|
|
- >
|
|
|
|
|
|
+ <af-table-column label="设备类型" align="center" prop="deviceType">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ {{
|
|
|
|
+ scope.row.deviceType == "1"
|
|
|
|
+ ? "小票打印机"
|
|
|
|
+ : scope.row.deviceType == "2"
|
|
|
|
+ ? "POS"
|
|
|
|
+ : "不明设备"
|
|
|
|
+ }}
|
|
|
|
+ </template>
|
|
|
|
+ </af-table-column>
|
|
|
|
+ <af-table-column label="设备编号" align="center" prop="deviceNo" />
|
|
|
|
+ <af-table-column label="设备密钥" align="center" prop="deviceSerialNum">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ {{ scope.row.deviceType == "1" ? scope.row.deviceSerialNum : "无" }}
|
|
|
|
+ </template>
|
|
|
|
+ </af-table-column>
|
|
|
|
+ <af-table-column label="绑定油枪号" align="center" prop="gunNo" />
|
|
|
|
+ <af-table-column label="设备厂家" align="center" prop="deviceFactory" />
|
|
|
|
+ <af-table-column label="启动状态" align="center" prop="deviceStatus">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
- {{scope.row.deviceStatus == "1" ? "开启":"关闭"}}
|
|
|
|
|
|
+ {{ scope.row.deviceStatus == "1" ? "开启" : "关闭" }}
|
|
</template>
|
|
</template>
|
|
- </el-table-column>
|
|
|
|
- <el-table-column
|
|
|
|
|
|
+ </af-table-column>
|
|
|
|
+ <af-table-column
|
|
label="操作"
|
|
label="操作"
|
|
align="center"
|
|
align="center"
|
|
class-name="small-padding fixed-width"
|
|
class-name="small-padding fixed-width"
|
|
|
|
+ width="120px"
|
|
>
|
|
>
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
<el-button
|
|
<el-button
|
|
@@ -112,7 +111,7 @@
|
|
>删除</el-button
|
|
>删除</el-button
|
|
>
|
|
>
|
|
</template>
|
|
</template>
|
|
- </el-table-column>
|
|
|
|
|
|
+ </af-table-column>
|
|
</el-table>
|
|
</el-table>
|
|
|
|
|
|
<pagination
|
|
<pagination
|
|
@@ -138,48 +137,78 @@
|
|
:rules="rules"
|
|
:rules="rules"
|
|
label-width="100px"
|
|
label-width="100px"
|
|
>
|
|
>
|
|
|
|
+ <el-form-item label="设备类型" prop="deviceType">
|
|
|
|
+ <el-select
|
|
|
|
+ v-model="dialogForm.deviceType"
|
|
|
|
+ placeholder="请选择设备类型"
|
|
|
|
+ clearable
|
|
|
|
+ size="small"
|
|
|
|
+ >
|
|
|
|
+ <el-option label="小票打印机" value="1"></el-option>
|
|
|
|
+ <el-option label="POS" value="2"></el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="设备名称" prop="deviceName">
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="dialogForm.deviceName"
|
|
|
|
+ placeholder="请输入设备名称"
|
|
|
|
+ />
|
|
|
|
+ </el-form-item>
|
|
<el-form-item label="设备编号" prop="deviceNo">
|
|
<el-form-item label="设备编号" prop="deviceNo">
|
|
<el-input
|
|
<el-input
|
|
v-model="dialogForm.deviceNo"
|
|
v-model="dialogForm.deviceNo"
|
|
placeholder="请输入设备编号"
|
|
placeholder="请输入设备编号"
|
|
|
|
+ @input="deviceNoInput"
|
|
/>
|
|
/>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item label="设备名称" prop="deviceName">
|
|
|
|
|
|
+ <el-form-item
|
|
|
|
+ label="密钥"
|
|
|
|
+ prop="deviceSerialNum"
|
|
|
|
+ :required="dialogForm.deviceType == 1"
|
|
|
|
+ v-show="dialogForm.deviceType == 1"
|
|
|
|
+ >
|
|
<el-input
|
|
<el-input
|
|
- v-model="dialogForm.deviceName"
|
|
|
|
- placeholder="请输入设备名称"
|
|
|
|
|
|
+ v-model="dialogForm.deviceSerialNum"
|
|
|
|
+ placeholder="请输入设备密钥"
|
|
/>
|
|
/>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item label="设备序列号" prop="deviceSerialNum">
|
|
|
|
|
|
+ <el-form-item
|
|
|
|
+ label="交换机名"
|
|
|
|
+ prop="posFanoutExchange"
|
|
|
|
+ :required="dialogForm.deviceType == 2"
|
|
|
|
+ v-show="false"
|
|
|
|
+ >
|
|
<el-input
|
|
<el-input
|
|
- v-model="dialogForm.deviceSerialNum"
|
|
|
|
- placeholder="请输入设备序列号"
|
|
|
|
|
|
+ v-model="dialogForm.posFanoutExchange"
|
|
|
|
+ placeholder="请输入交换机名"
|
|
/>
|
|
/>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item label="设备类型" prop="deviceType">
|
|
|
|
- <el-select
|
|
|
|
- v-model="dialogForm.deviceType"
|
|
|
|
- placeholder="请选择设备类型"
|
|
|
|
- clearable
|
|
|
|
- size="small"
|
|
|
|
- >
|
|
|
|
- <el-option
|
|
|
|
- v-for="dict in deviceTypeOptions"
|
|
|
|
- :key="dict.dictValue"
|
|
|
|
- :label="dict.dictLabel"
|
|
|
|
- :value="dict.dictValue"
|
|
|
|
- ></el-option>
|
|
|
|
- </el-select>
|
|
|
|
|
|
+ <el-form-item
|
|
|
|
+ label="队列名"
|
|
|
|
+ prop="posQueue"
|
|
|
|
+ :required="dialogForm.deviceType==2"
|
|
|
|
+ v-show="false"
|
|
|
|
+ >
|
|
|
|
+ <el-input v-model="dialogForm.posQueue" placeholder="请输入队列名" />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
-
|
|
|
|
<el-form-item label="绑定油枪号" prop="checkedGunList" required>
|
|
<el-form-item label="绑定油枪号" prop="checkedGunList" required>
|
|
<template v-if="allGunList.length === 0">
|
|
<template v-if="allGunList.length === 0">
|
|
请先在油枪管理里配置油枪
|
|
请先在油枪管理里配置油枪
|
|
</template>
|
|
</template>
|
|
<template v-else>
|
|
<template v-else>
|
|
- <el-checkbox-group v-model="dialogForm.checkedGunList">
|
|
|
|
|
|
+ <el-checkbox-group v-model="dialogForm.checkedGunList" v-if="dialogForm.deviceType == 2">
|
|
|
|
+ <el-checkbox
|
|
|
|
+ v-for="item in posList"
|
|
|
|
+ :key="item.oilGunId"
|
|
|
|
+ :label="item.oilGunNo"
|
|
|
|
+ :value="item.oilGunNo"
|
|
|
|
+ >
|
|
|
|
+ {{ item.oilGunNo + "号枪/" + item.oilName }}
|
|
|
|
+ </el-checkbox>
|
|
|
|
+ </el-checkbox-group>
|
|
|
|
+ <el-checkbox-group v-model="dialogForm.checkedGunList" v-if="dialogForm.deviceType == 1">
|
|
<el-checkbox
|
|
<el-checkbox
|
|
- v-for="item in allGunList"
|
|
|
|
|
|
+ v-for="item in printList"
|
|
:key="item.oilGunId"
|
|
:key="item.oilGunId"
|
|
:label="item.oilGunNo"
|
|
:label="item.oilGunNo"
|
|
:value="item.oilGunNo"
|
|
:value="item.oilGunNo"
|
|
@@ -196,12 +225,8 @@
|
|
size="small"
|
|
size="small"
|
|
placeholder="请选择"
|
|
placeholder="请选择"
|
|
>
|
|
>
|
|
- <el-option
|
|
|
|
- v-for="dict in deviceStatusOptions"
|
|
|
|
- :key="dict.dictValue"
|
|
|
|
- :label="dict.dictLabel"
|
|
|
|
- :value="dict.dictValue"
|
|
|
|
- ></el-option>
|
|
|
|
|
|
+ <el-option label="在用" value="1"></el-option>
|
|
|
|
+ <el-option label="停用" value="2"></el-option>
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="设备厂家" prop="deviceFactory">
|
|
<el-form-item label="设备厂家" prop="deviceFactory">
|
|
@@ -265,14 +290,15 @@ export default {
|
|
pageNum: 1,
|
|
pageNum: 1,
|
|
pageSize: 10, // 初始值只能比10大
|
|
pageSize: 10, // 初始值只能比10大
|
|
deviceNo: null,
|
|
deviceNo: null,
|
|
- stationId: this.deptId,
|
|
|
|
- deviceType: null, // 设备类型 数据字典里取
|
|
|
|
- deviceSerialNum: null, // 设备序列号
|
|
|
|
|
|
+ deviceSerialNum: null, // 设备密钥
|
|
},
|
|
},
|
|
// 弹窗表单参数
|
|
// 弹窗表单参数
|
|
dialogForm: {
|
|
dialogForm: {
|
|
- checkedGunList:[]
|
|
|
|
|
|
+ checkedGunList: [],
|
|
|
|
+ deviceStatus: "1",
|
|
|
|
+ deviceType: "1",
|
|
},
|
|
},
|
|
|
|
+ currentList: [],
|
|
// 表单校验
|
|
// 表单校验
|
|
rules: {
|
|
rules: {
|
|
deviceNo: [
|
|
deviceNo: [
|
|
@@ -281,15 +307,13 @@ export default {
|
|
deviceName: [
|
|
deviceName: [
|
|
{ required: true, message: "请输入设备名", trigger: "blur" },
|
|
{ required: true, message: "请输入设备名", trigger: "blur" },
|
|
],
|
|
],
|
|
- deviceSerialNum: [
|
|
|
|
- { required: true, message: "请输入设备序列号", trigger: "blur" },
|
|
|
|
- ],
|
|
|
|
|
|
+ // deviceSerialNum: [
|
|
|
|
+ // { required: true, message: "请输入设备密钥", trigger: "blur" },
|
|
|
|
+ // ],
|
|
deviceType: [
|
|
deviceType: [
|
|
{ required: true, message: "请选择设备类型", trigger: "blur" },
|
|
{ required: true, message: "请选择设备类型", trigger: "blur" },
|
|
],
|
|
],
|
|
- checkedGunList: [
|
|
|
|
- { validator: validateGunNo, trigger: 'change' }
|
|
|
|
- ],
|
|
|
|
|
|
+ checkedGunList: [{ validator: validateGunNo, trigger: "change" }],
|
|
deviceStatus: [
|
|
deviceStatus: [
|
|
{ required: true, message: "请选择设备状态", trigger: "blur" },
|
|
{ required: true, message: "请选择设备状态", trigger: "blur" },
|
|
],
|
|
],
|
|
@@ -300,9 +324,60 @@ export default {
|
|
};
|
|
};
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
|
|
+ console.log(this.deptId);
|
|
this.getList();
|
|
this.getList();
|
|
this.init();
|
|
this.init();
|
|
},
|
|
},
|
|
|
|
+ computed: {
|
|
|
|
+ posList() {
|
|
|
|
+ const temp = this.allGunList.filter((item) => {
|
|
|
|
+ let flag = false;
|
|
|
|
+ this.equipmentList.map((ele) => {
|
|
|
|
+ if (ele.deviceType == 2) {
|
|
|
|
+ if (ele.gunNo.split(",").includes(item.oilGunNo)) {
|
|
|
|
+ flag = true;
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ return flag;
|
|
|
|
+ });
|
|
|
|
+ const temp2 = this.allGunList.filter((item) => {
|
|
|
|
+ let flag = true;
|
|
|
|
+ temp.map((ele) => {
|
|
|
|
+ if (item.oilGunNo == ele.oilGunNo) {
|
|
|
|
+ flag = false;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ return flag;
|
|
|
|
+ });
|
|
|
|
+ return this.currentList.concat(temp2)
|
|
|
|
+ },
|
|
|
|
+ printList() {
|
|
|
|
+ const temp = this.allGunList.filter((item) => {
|
|
|
|
+ let flag = false;
|
|
|
|
+ this.equipmentList.map((ele) => {
|
|
|
|
+ if (ele.deviceType == 1) {
|
|
|
|
+ if (ele.gunNo.split(",").includes(item.oilGunNo)) {
|
|
|
|
+ flag = true;
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ return flag;
|
|
|
|
+ });
|
|
|
|
+ const temp2 = this.allGunList.filter((item) => {
|
|
|
|
+ let flag = true;
|
|
|
|
+ temp.map((ele) => {
|
|
|
|
+ if (item.oilGunNo == ele.oilGunNo) {
|
|
|
|
+ flag = false;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ return flag;
|
|
|
|
+ });
|
|
|
|
+ return this.currentList.concat(temp2)
|
|
|
|
+ },
|
|
|
|
+ },
|
|
methods: {
|
|
methods: {
|
|
init() {
|
|
init() {
|
|
//字典设备状态
|
|
//字典设备状态
|
|
@@ -313,28 +388,33 @@ export default {
|
|
this.getDicts("device_type").then((response) => {
|
|
this.getDicts("device_type").then((response) => {
|
|
this.deviceTypeOptions = response.data;
|
|
this.deviceTypeOptions = response.data;
|
|
});
|
|
});
|
|
|
|
+ listGun({
|
|
|
|
+ stationId: this.deptId,
|
|
|
|
+ }).then((response) => {
|
|
|
|
+ this.allGunList = response.rows;
|
|
|
|
+ console.log(this.allGunList);
|
|
|
|
+ });
|
|
},
|
|
},
|
|
/** 查询油站设备管理列表 首页表单 */
|
|
/** 查询油站设备管理列表 首页表单 */
|
|
getList() {
|
|
getList() {
|
|
listManage(this.queryForm).then((response) => {
|
|
listManage(this.queryForm).then((response) => {
|
|
this.equipmentList = response.rows;
|
|
this.equipmentList = response.rows;
|
|
|
|
+ console.log("this.equipmentList", this.equipmentList);
|
|
this.total = response.total;
|
|
this.total = response.total;
|
|
});
|
|
});
|
|
},
|
|
},
|
|
// 取消按钮
|
|
// 取消按钮
|
|
cancel() {
|
|
cancel() {
|
|
this.open = false;
|
|
this.open = false;
|
|
- this.reset();
|
|
|
|
- },
|
|
|
|
- // 表单重置
|
|
|
|
- reset() {
|
|
|
|
- this.dialogForm = {};
|
|
|
|
},
|
|
},
|
|
/** 搜索按钮操作 */
|
|
/** 搜索按钮操作 */
|
|
handleQuery() {
|
|
handleQuery() {
|
|
this.queryForm.pageNum = 1;
|
|
this.queryForm.pageNum = 1;
|
|
this.getList();
|
|
this.getList();
|
|
},
|
|
},
|
|
|
|
+ deviceNoInput(value) {
|
|
|
|
+ this.dialogForm.posQueue = value;
|
|
|
|
+ },
|
|
/** 重置按钮操作 */
|
|
/** 重置按钮操作 */
|
|
resetQuery() {
|
|
resetQuery() {
|
|
this.resetForm("queryForm");
|
|
this.resetForm("queryForm");
|
|
@@ -342,37 +422,30 @@ export default {
|
|
},
|
|
},
|
|
/** 新增按钮操作 */
|
|
/** 新增按钮操作 */
|
|
handleAdd() {
|
|
handleAdd() {
|
|
- if (this.jiBie === 2) {
|
|
|
|
- this.title = "添加油站设备管理";
|
|
|
|
- this.open = true;
|
|
|
|
- listGun({
|
|
|
|
- stationId: this.deptId,
|
|
|
|
- }).then((response) => {
|
|
|
|
- this.allGunList = response.rows;
|
|
|
|
- });
|
|
|
|
- } else {
|
|
|
|
- this.msgSuccess("请登录对应的账号");
|
|
|
|
- }
|
|
|
|
|
|
+ this.currentList = [];
|
|
|
|
+ this.title = "添加油站设备管理";
|
|
|
|
+ this.dialogForm = {
|
|
|
|
+ checkedGunList: [],
|
|
|
|
+ deviceStatus: "1",
|
|
|
|
+ deviceType: "1",
|
|
|
|
+ posFanoutExchange: "posFanoutExchange" + this.deptId,
|
|
|
|
+ };
|
|
|
|
+ this.open = true;
|
|
},
|
|
},
|
|
/** 修改按钮操作 */
|
|
/** 修改按钮操作 */
|
|
handleUpdate(row) {
|
|
handleUpdate(row) {
|
|
- let checkedGunList
|
|
|
|
- if (
|
|
|
|
- Object.prototype.toString.call(row.gunNo) ===
|
|
|
|
- "[object String]"
|
|
|
|
- ) {
|
|
|
|
|
|
+ this.currentList = this.allGunList.filter((ele)=>{
|
|
|
|
+ return row.gunNo.split(",").includes(ele.oilGunNo)
|
|
|
|
+ })
|
|
|
|
+ let checkedGunList;
|
|
|
|
+ if (Object.prototype.toString.call(row.gunNo) === "[object String]") {
|
|
checkedGunList = [...new Set(row.gunNo.split(","))].filter((ele) => {
|
|
checkedGunList = [...new Set(row.gunNo.split(","))].filter((ele) => {
|
|
return ele.toString().trim() !== "";
|
|
return ele.toString().trim() !== "";
|
|
- });
|
|
|
|
- }else{
|
|
|
|
- checkedGunList = []
|
|
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ checkedGunList = [];
|
|
}
|
|
}
|
|
- this.dialogForm={...row, checkedGunList}
|
|
|
|
- listGun({
|
|
|
|
- stationId: this.deptId,
|
|
|
|
- }).then((response) => {
|
|
|
|
- this.allGunList = response.rows;
|
|
|
|
- });
|
|
|
|
|
|
+ this.dialogForm = { ...row, checkedGunList };
|
|
this.title = "修改油站设备管理";
|
|
this.title = "修改油站设备管理";
|
|
this.open = true;
|
|
this.open = true;
|
|
},
|
|
},
|
|
@@ -381,7 +454,7 @@ export default {
|
|
submitForm() {
|
|
submitForm() {
|
|
this.$refs["dialogForm"].validate((valid) => {
|
|
this.$refs["dialogForm"].validate((valid) => {
|
|
if (valid) {
|
|
if (valid) {
|
|
- this.dialogForm.gunNo = this.dialogForm.checkedGunList.toString()
|
|
|
|
|
|
+ this.dialogForm.gunNo = this.dialogForm.checkedGunList.toString();
|
|
if (this.dialogForm.deviceId != null) {
|
|
if (this.dialogForm.deviceId != null) {
|
|
updateManage(this.dialogForm).then((response) => {
|
|
updateManage(this.dialogForm).then((response) => {
|
|
this.msgSuccess("修改成功");
|
|
this.msgSuccess("修改成功");
|