瀏覽代碼

add 添加并引用状态组件

docs_0727
lb 1 年之前
父節點
當前提交
766de83deb
共有 6 個檔案被更改,包括 106 行新增9 行删除
  1. +90
    -0
      src/components/StateSelect.vue
  2. +3
    -2
      src/views/modules/pms/carHistory/config.js
  3. +4
    -1
      src/views/modules/pms/currentCarLocation/config.js
  4. +3
    -2
      src/views/modules/pms/detectionPlatform/config.js
  5. +3
    -2
      src/views/modules/pms/kilnWaitingRoom/config.js
  6. +3
    -2
      src/views/modules/pms/palletizingLine/config.js

+ 90
- 0
src/components/StateSelect.vue 查看文件

@@ -0,0 +1,90 @@
<template>
<div class="state-select">
<select name="state" id="state" @change.stop.prevent="handleChange" :key="selectKey" style="color: #606266;">
<option v-for="(opt, index) in options" :key="index" :value="opt.value" :selected="chosen === opt.value">
{{ opt.label }}
</option>
</select>
</div>
</template>

<script>
import { getDictDataList } from "@/utils";

export default {
name: "StateSelect",
props: {
injectData: {
type: Object,
default: () => null,
},
},
data() {
const d = getDictDataList("car_state");
const chosen = this.injectData.stateDictValue;
return {
options: d.map((o) => ({
value: o.dictValue,
label: o.dictLabel,
})),
chosen,
selectKey: 0,
};
},
methods: {
handleChange(e) {
const old = this.chosen;
const value = e.target.value;

const { id } = this.injectData;

this.$confirm("确定更改窑车状态?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
return this.$http
.post("/pms/carHandle/change", {
id,
stateDictValue: value,
})
.then(({ data: res }) => {
if (res.code === 0) {
this.chosen = value;
this.$nextTick(() => {
this.selectKey = Math.random();
});
this.$message({
message: "更新成功",
duration: 1500,
type: "success",
});
} else {
this.$message({
message: "更新失败",
duration: 1500,
type: "error",
});
throw new Error();
}
});
})
.catch(() => {
this.chosen = old;
this.$nextTick(() => {
this.selectKey = Math.random();
});
});
},
},
};
</script>

<style scoped>
.state-select >>> #state {
width: 100%;
/* appearance: unset; */
border: none;
}
</style>

+ 3
- 2
src/views/modules/pms/carHistory/config.js 查看文件

@@ -1,5 +1,5 @@
import TableOperaionComponent from "@/components/noTemplateComponents/operationComponent";
import StateSelect from '@/components/StateSelect.vue';
import request from "@/utils/request";
import { timeFilter } from '@/utils/filters'

@@ -8,7 +8,8 @@ export default function () {
{ type: 'index', label: '序号' },
{ prop: "createTime", label: "添加时间", filter: timeFilter },
{ prop: "code", label: "窑车号" },
{ prop: "stateDictValue", label: "状态", filter: v => (v !== null && v !== undefined) ? ['没有数据', '正常', '判废', '过渡'][v] : '-' }, // subcomponent
{ prop: "stateDictValue", label: "状态", subcomponent: StateSelect },
// { prop: "stateDictValue", label: "状态", filter: v => (v !== null && v !== undefined) ? ['没有数据', '正常', '判废', '过渡'][v] : '-' }, // subcomponent
{ prop: "orderCode", label: "订单号" },
{ prop: "posCode", label: "位置" },
{ prop: "startTime", label: "开始时间", filter: timeFilter },


+ 4
- 1
src/views/modules/pms/currentCarLocation/config.js 查看文件

@@ -2,12 +2,15 @@ import TableOperaionComponent from "@/components/noTemplateComponents/operationC
import request from "@/utils/request";
import { timeFilter } from "@/utils/filters";

import StateSelect from '@/components/StateSelect.vue';

export default function () {
const tableProps = [
{ type: "index", label: "序号" },
{ prop: "createTime", label: "添加时间", filter: timeFilter },
{ prop: "code", label: "窑车号" },
{ prop: "stateDictValue", label: "状态", filter: (v) => (v !== null && v !== undefined ? ["没有数据", "正常", "判废", "过渡"][v] : "-") }, // subcomponent
{ prop: "stateDictValue", label: "状态", subcomponent: StateSelect },
// { prop: "stateDictValue", label: "状态", filter: (v) => (v !== null && v !== undefined ? ["没有数据", "正常", "判废", "过渡"][v] : "-") }, // subcomponent
{ prop: "orderCode", label: "订单号" },
{ prop: "posCode", label: "位置" },
{ prop: "startTime", label: "开始时间", filter: timeFilter },


+ 3
- 2
src/views/modules/pms/detectionPlatform/config.js 查看文件

@@ -1,5 +1,5 @@
import TableOperaionComponent from "@/components/noTemplateComponents/operationComponent";
import StateSelect from '@/components/StateSelect.vue';
import request from "@/utils/request";
import { timeFilter } from '@/utils/filters'
import { getDictDataList } from '@/utils'
@@ -9,7 +9,8 @@ export default function () {
{ type: 'index', label: '序号' },
{ prop: "createTime", label: "添加时间", filter: timeFilter },
{ prop: "code", label: "窑车号" },
{ prop: "stateDictValue", label: "状态", filter: v => (v !== null && v !== undefined) ? ['没有数据', '正常', '判废', '过渡'][v] : '-' }, // subcomponent
{ prop: "stateDictValue", label: "状态", subcomponent: StateSelect },
// { prop: "stateDictValue", label: "状态", filter: v => (v !== null && v !== undefined) ? ['没有数据', '正常', '判废', '过渡'][v] : '-' }, // subcomponent
{ prop: "orderCode", label: "订单号" },
{ prop: "posCode", label: "位置" },
{ prop: "startTime", label: "开始时间", filter: timeFilter },


+ 3
- 2
src/views/modules/pms/kilnWaitingRoom/config.js 查看文件

@@ -1,5 +1,5 @@
import TableOperaionComponent from "@/components/noTemplateComponents/operationComponent";
import StateSelect from '@/components/StateSelect.vue';
import request from "@/utils/request";
import { timeFilter } from '@/utils/filters'
import { getDictDataList } from '@/utils'
@@ -9,7 +9,8 @@ export default function () {
{ type: 'index', label: '序号' },
{ prop: "createTime", label: "添加时间", filter: timeFilter },
{ prop: "code", label: "窑车号" },
{ prop: "stateDictValue", label: "状态", filter: v => (v !== null && v !== undefined) ? ['没有数据', '正常', '判废', '过渡'][v] : '-' }, // subcomponent
{ prop: "stateDictValue", label: "状态", subcomponent: StateSelect },
// { prop: "stateDictValue", label: "状态", filter: v => (v !== null && v !== undefined) ? ['没有数据', '正常', '判废', '过渡'][v] : '-' }, // subcomponent
{ prop: "orderCode", label: "订单号" },
{ prop: "posCode", label: "位置" },
{ prop: "startTime", label: "开始时间", filter: timeFilter },


+ 3
- 2
src/views/modules/pms/palletizingLine/config.js 查看文件

@@ -1,5 +1,5 @@
import TableOperaionComponent from "@/components/noTemplateComponents/operationComponent";
import StateSelect from '@/components/StateSelect.vue';
import request from "@/utils/request";
import { timeFilter } from '@/utils/filters'
import { getDictDataList } from '@/utils'
@@ -9,7 +9,8 @@ export default function () {
{ type: 'index', label: '序号' },
{ prop: "createTime", label: "添加时间", filter: timeFilter },
{ prop: "code", label: "窑车号" },
{ prop: "stateDictValue", label: "状态", filter: v => (v !== null && v !== undefined) ? ['没有数据', '正常', '判废', '过渡'][v] : '-' }, // subcomponent
{ prop: "stateDictValue", label: "状态", subcomponent: StateSelect },
// { prop: "stateDictValue", label: "状态", filter: v => (v !== null && v !== undefined) ? ['没有数据', '正常', '判废', '过渡'][v] : '-' }, // subcomponent
{ prop: "orderCode", label: "订单号" },
{ prop: "posCode", label: "位置" },
{ prop: "startTime", label: "开始时间", filter: timeFilter },


Loading…
取消
儲存