|
|
@@ -45,7 +45,7 @@
|
|
|
trigger="hover"
|
|
|
content="数值越大优先级越高(0-3普通, 4-6优先, 7-10紧急)"
|
|
|
>
|
|
|
- <div class="sort-wrap" slot="reference">
|
|
|
+ <div class="sort-wrap" slot="reference">
|
|
|
<i class="el-icon-caret-top" @click="sortTop(row)"></i>
|
|
|
<i class="el-icon-caret-bottom" @click="sortBottom(row)"></i>
|
|
|
</div>
|
|
|
@@ -108,193 +108,194 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import { getList, del, updatePriority } from '@/api/productionPlan/index.js';
|
|
|
- import productionPlanSearch from './components/productionPlan-search.vue';
|
|
|
- import { release } from '@/api/productionPlan/order.js';
|
|
|
- import { multiply } from '@/utils/math';
|
|
|
- import { getCode } from '@/api/codeManagement';
|
|
|
- import { debounce } from 'lodash';
|
|
|
- export default {
|
|
|
- components: {
|
|
|
- productionPlanSearch
|
|
|
- },
|
|
|
- data() {
|
|
|
- return {
|
|
|
- activeName: 'first',
|
|
|
+import { getList, del, updatePriority } from '@/api/productionPlan/index.js';
|
|
|
+import productionPlanSearch from './components/productionPlan-search.vue';
|
|
|
+import { release } from '@/api/productionPlan/order.js';
|
|
|
+import { multiply } from '@/utils/math';
|
|
|
+import { getCode } from '@/api/codeManagement';
|
|
|
+import { debounce } from 'lodash';
|
|
|
+export default {
|
|
|
+ components: {
|
|
|
+ productionPlanSearch
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ activeName: 'first',
|
|
|
|
|
|
- // 加载状态
|
|
|
- loading: false,
|
|
|
- pageType: 'add',
|
|
|
- dialogTitle: '',
|
|
|
- isBindPlan: false,
|
|
|
- statusOpt: {
|
|
|
- first: [
|
|
|
- { label: '所有状态', value: '3,2' },
|
|
|
- { label: '待发布', value: '2' },
|
|
|
- { label: '发布失败', value: '3' }
|
|
|
- ],
|
|
|
- second: [
|
|
|
- { label: '所有状态', value: '7,4,5,6' },
|
|
|
- { label: '待生产', value: '4' },
|
|
|
- { label: '生产中', value: '5' },
|
|
|
- { label: '已完成', value: '6' },
|
|
|
- { label: '已延期', value: '7' }
|
|
|
- ]
|
|
|
- },
|
|
|
- planType: [
|
|
|
- { label: '所有计划类型', value: null },
|
|
|
- { label: '内销计划', value: '1' },
|
|
|
- { label: '外销计划', value: '2' },
|
|
|
- { label: '预制计划', value: '3' }
|
|
|
+ // 加载状态
|
|
|
+ loading: false,
|
|
|
+ pageType: 'add',
|
|
|
+ dialogTitle: '',
|
|
|
+ isBindPlan: false,
|
|
|
+ statusOpt: {
|
|
|
+ first: [
|
|
|
+ { label: '所有状态', value: '3,2' },
|
|
|
+ { label: '待发布', value: '2' },
|
|
|
+ { label: '发布失败', value: '3' }
|
|
|
+ ],
|
|
|
+ second: [
|
|
|
+ { label: '所有状态', value: '7,4,5,6' },
|
|
|
+ { label: '待生产', value: '4' },
|
|
|
+ { label: '生产中', value: '5' },
|
|
|
+ { label: '已完成', value: '6' },
|
|
|
+ { label: '已延期', value: '7' }
|
|
|
]
|
|
|
- };
|
|
|
+ },
|
|
|
+ planType: [
|
|
|
+ { label: '所有计划类型', value: null },
|
|
|
+ { label: '内销计划', value: '1' },
|
|
|
+ { label: '外销计划', value: '2' },
|
|
|
+ { label: '预制计划', value: '3' }
|
|
|
+ ]
|
|
|
+ };
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ clientEnvironmentId() {
|
|
|
+ return this.$store.state.user.info.clientEnvironmentId;
|
|
|
},
|
|
|
- computed: {
|
|
|
- // 表格列配置
|
|
|
- columns() {
|
|
|
- const opt = {
|
|
|
- first: [
|
|
|
- // {
|
|
|
- // prop: 'deliveryTime',
|
|
|
- // label: '预测交货日期',
|
|
|
- // align: 'center',
|
|
|
- // showOverflowTooltip: true,
|
|
|
- // minWidth: 110
|
|
|
- // }
|
|
|
- ],
|
|
|
- second: [
|
|
|
- // {
|
|
|
- // prop: 'formingTime',
|
|
|
- // label: '实际生产日期',
|
|
|
- // align: 'center',
|
|
|
- // showOverflowTooltip: true,
|
|
|
- // minWidth: 110
|
|
|
- // },
|
|
|
- {
|
|
|
- prop: 'releaseTime',
|
|
|
- label: '工单发布日期',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 110
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'planFormingTime',
|
|
|
- label: '预测生产日期',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 110
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'deliveryTime',
|
|
|
- label: '预测交货日期',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 110
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'formingTime',
|
|
|
- label: '实际交货日期',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 110
|
|
|
- }
|
|
|
- ]
|
|
|
- };
|
|
|
-
|
|
|
- return [
|
|
|
+ // 表格列配置
|
|
|
+ columns() {
|
|
|
+ const opt = {
|
|
|
+ first: [
|
|
|
+ // {
|
|
|
+ // prop: 'deliveryTime',
|
|
|
+ // label: '预测交货日期',
|
|
|
+ // align: 'center',
|
|
|
+ // showOverflowTooltip: true,
|
|
|
+ // minWidth: 110
|
|
|
+ // }
|
|
|
+ ],
|
|
|
+ second: [
|
|
|
+ // {
|
|
|
+ // prop: 'formingTime',
|
|
|
+ // label: '实际生产日期',
|
|
|
+ // align: 'center',
|
|
|
+ // showOverflowTooltip: true,
|
|
|
+ // minWidth: 110
|
|
|
+ // },
|
|
|
{
|
|
|
- columnKey: 'index',
|
|
|
- label: '序号',
|
|
|
- type: 'index',
|
|
|
- width: 55,
|
|
|
+ prop: 'releaseTime',
|
|
|
+ label: '工单发布日期',
|
|
|
align: 'center',
|
|
|
showOverflowTooltip: true,
|
|
|
- fixed: 'left'
|
|
|
+ minWidth: 110
|
|
|
},
|
|
|
{
|
|
|
- slot: 'code',
|
|
|
- prop: 'code',
|
|
|
- action: 'code',
|
|
|
- label: '计划编号',
|
|
|
+ prop: 'planFormingTime',
|
|
|
+ label: '预测生产日期',
|
|
|
align: 'center',
|
|
|
showOverflowTooltip: true,
|
|
|
- minWidth: 180
|
|
|
+ minWidth: 110
|
|
|
},
|
|
|
{
|
|
|
- prop: 'productCode',
|
|
|
- label: '产品编码',
|
|
|
+ prop: 'deliveryTime',
|
|
|
+ label: '预测交货日期',
|
|
|
align: 'center',
|
|
|
showOverflowTooltip: true,
|
|
|
- minWidth: 140
|
|
|
+ minWidth: 110
|
|
|
},
|
|
|
{
|
|
|
- prop: 'productName',
|
|
|
- label: '产品名称',
|
|
|
+ prop: 'formingTime',
|
|
|
+ label: '实际交货日期',
|
|
|
align: 'center',
|
|
|
showOverflowTooltip: true,
|
|
|
- minWidth: 140
|
|
|
- },
|
|
|
+ minWidth: 110
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ };
|
|
|
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ columnKey: 'index',
|
|
|
+ label: '序号',
|
|
|
+ type: 'index',
|
|
|
+ width: 55,
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ fixed: 'left'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ slot: 'code',
|
|
|
+ prop: 'code',
|
|
|
+ action: 'code',
|
|
|
+ label: '计划编号',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 180
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'productCode',
|
|
|
+ label: '产品编码',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 140
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'productName',
|
|
|
+ label: '产品名称',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 140
|
|
|
+ },
|
|
|
|
|
|
- {
|
|
|
- prop: 'brandNo',
|
|
|
- label: '牌号',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'batchNo',
|
|
|
- label: '批号',
|
|
|
- align: 'center',
|
|
|
- minWidth: 100,
|
|
|
- showOverflowTooltip: true
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'model',
|
|
|
- label: '型号',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true
|
|
|
- },
|
|
|
-
|
|
|
+ {
|
|
|
+ prop: 'brandNo',
|
|
|
+ label: '牌号',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'batchNo',
|
|
|
+ label: '批号',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 100,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'model',
|
|
|
+ label: '型号',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
|
|
|
- {
|
|
|
- prop: 'priority',
|
|
|
- label: '优先级',
|
|
|
- align: 'center',
|
|
|
- minWidth: 120,
|
|
|
- slot: 'priority',
|
|
|
- sortable: 'custom'
|
|
|
- },
|
|
|
+ {
|
|
|
+ prop: 'priority',
|
|
|
+ label: '优先级',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 120,
|
|
|
+ slot: 'priority',
|
|
|
+ sortable: 'custom'
|
|
|
+ },
|
|
|
|
|
|
- {
|
|
|
- prop: 'productNum',
|
|
|
- label: '计划数量(方)',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'productWeight',
|
|
|
- label: '计划重量',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- slot: 'productWeight'
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'requiredFormingNum',
|
|
|
- label: '要求生产数量(方)',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true
|
|
|
- },
|
|
|
+ {
|
|
|
+ prop: 'productNum',
|
|
|
+ label: '计划数量'+(this.clientEnvironmentId=='4'?'(方)':''),
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'productWeight',
|
|
|
+ label: '计划重量',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ slot: 'productWeight'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'requiredFormingNum',
|
|
|
+ label: '要求生产数量'+(this.clientEnvironmentId=='4'?'(方)':''),
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
|
|
|
- {
|
|
|
- prop: 'newSumOrderWeight',
|
|
|
- label: '要求生产重量',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- slot: 'newSumOrderWeight'
|
|
|
- },
|
|
|
+ {
|
|
|
+ prop: 'newSumOrderWeight',
|
|
|
+ label: '要求生产重量',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ slot: 'newSumOrderWeight'
|
|
|
+ },
|
|
|
|
|
|
- {
|
|
|
+ {
|
|
|
prop: 'moCount',
|
|
|
label: '模数',
|
|
|
align: 'center'
|
|
|
@@ -312,208 +313,206 @@
|
|
|
showOverflowTooltip: true,
|
|
|
minWidth: 110
|
|
|
},
|
|
|
- {
|
|
|
- prop: 'reqMoldTime',
|
|
|
- label: '要求生产日期',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 110
|
|
|
- },
|
|
|
+ {
|
|
|
+ prop: 'reqMoldTime',
|
|
|
+ label: '要求生产日期',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 110
|
|
|
+ },
|
|
|
|
|
|
- ...opt[this.activeName],
|
|
|
+ ...opt[this.activeName],
|
|
|
|
|
|
- {
|
|
|
- prop: 'orderType',
|
|
|
- label: '计划类型',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- formatter: (row) => {
|
|
|
- const obj = this.planType.find((i) => i.value == row.planType);
|
|
|
- return obj && obj.label;
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'createTime',
|
|
|
- label: '创建时间',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 110
|
|
|
- },
|
|
|
- {
|
|
|
- columnKey: 'status',
|
|
|
- slot: 'status',
|
|
|
- label: '状态',
|
|
|
- align: 'center',
|
|
|
- formatter: (row) => {
|
|
|
- const obj = this.statusOpt[this.activeName].find(
|
|
|
- (i) => i.value == row.status
|
|
|
- );
|
|
|
- return obj && obj.label;
|
|
|
- }
|
|
|
- },
|
|
|
- // ...(this.activeName === 'second'
|
|
|
- // ? [
|
|
|
- // {
|
|
|
- // prop: 'releaseTime',
|
|
|
- // label: '发布时间',
|
|
|
- // align: 'center',
|
|
|
- // showOverflowTooltip: true,
|
|
|
- // minWidth: 110
|
|
|
- // }
|
|
|
- // ]
|
|
|
- // : []),
|
|
|
- ...(this.activeName === 'first'
|
|
|
- ? [
|
|
|
- {
|
|
|
- columnKey: 'action',
|
|
|
- label: '操作',
|
|
|
- width: 250,
|
|
|
- align: 'center',
|
|
|
- resizable: false,
|
|
|
- fixed: 'right',
|
|
|
- slot: 'action',
|
|
|
- showOverflowTooltip: true
|
|
|
- }
|
|
|
- ]
|
|
|
- : [])
|
|
|
- ];
|
|
|
- }
|
|
|
- },
|
|
|
- methods: {
|
|
|
- statusFormatter(status) {
|
|
|
- const obj = this.statusOpt[this.activeName].find(
|
|
|
- (i) => i.value == status
|
|
|
- );
|
|
|
-
|
|
|
- return obj && obj.label;
|
|
|
- },
|
|
|
- /* 表格数据源 */
|
|
|
- datasource({ page, limit, where }) {
|
|
|
- return getList({
|
|
|
- pageNum: page,
|
|
|
- size: limit,
|
|
|
- ...where,
|
|
|
- ...this.sort
|
|
|
- });
|
|
|
- },
|
|
|
- // 发布工单
|
|
|
- handleOrderPublish(type, row) {
|
|
|
- this.$confirm('发布工单后不可撤回,确定发布吗?', '发布确认')
|
|
|
- .then(async () => {
|
|
|
- const loading = this.$loading({
|
|
|
- lock: true,
|
|
|
- fullscreen: true,
|
|
|
- text: '工单发布中...'
|
|
|
- });
|
|
|
- try {
|
|
|
- let code = row.workOrderCode;
|
|
|
- if (!code) {
|
|
|
- code = await getCode('product_order_code');
|
|
|
- }
|
|
|
- // 反显对象会报错 status
|
|
|
- const data = await release([row.id]);
|
|
|
- if (data || data === 0) {
|
|
|
- this.$message.success('发布成功!');
|
|
|
- } else {
|
|
|
- this.$message.error('发布失败,请重新发布!');
|
|
|
+ {
|
|
|
+ prop: 'orderType',
|
|
|
+ label: '计划类型',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ formatter: (row) => {
|
|
|
+ const obj = this.planType.find((i) => i.value == row.planType);
|
|
|
+ return obj && obj.label;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'createTime',
|
|
|
+ label: '创建时间',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 110
|
|
|
+ },
|
|
|
+ {
|
|
|
+ columnKey: 'status',
|
|
|
+ slot: 'status',
|
|
|
+ label: '状态',
|
|
|
+ align: 'center',
|
|
|
+ formatter: (row) => {
|
|
|
+ const obj = this.statusOpt[this.activeName].find(
|
|
|
+ (i) => i.value == row.status
|
|
|
+ );
|
|
|
+ return obj && obj.label;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // ...(this.activeName === 'second'
|
|
|
+ // ? [
|
|
|
+ // {
|
|
|
+ // prop: 'releaseTime',
|
|
|
+ // label: '发布时间',
|
|
|
+ // align: 'center',
|
|
|
+ // showOverflowTooltip: true,
|
|
|
+ // minWidth: 110
|
|
|
+ // }
|
|
|
+ // ]
|
|
|
+ // : []),
|
|
|
+ ...(this.activeName === 'first'
|
|
|
+ ? [
|
|
|
+ {
|
|
|
+ columnKey: 'action',
|
|
|
+ label: '操作',
|
|
|
+ width: 250,
|
|
|
+ align: 'center',
|
|
|
+ resizable: false,
|
|
|
+ fixed: 'right',
|
|
|
+ slot: 'action',
|
|
|
+ showOverflowTooltip: true
|
|
|
}
|
|
|
- this.reload();
|
|
|
- } catch (error) {
|
|
|
- console.error(error);
|
|
|
- }
|
|
|
- loading.close();
|
|
|
- })
|
|
|
- .catch((err) => {
|
|
|
- console.error(err);
|
|
|
- });
|
|
|
+ ]
|
|
|
+ : [])
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ statusFormatter(status) {
|
|
|
+ const obj = this.statusOpt[this.activeName].find(
|
|
|
+ (i) => i.value == status
|
|
|
+ );
|
|
|
|
|
|
- // this.$router.push({
|
|
|
- // path: '/productionPlan/workOrderPublish',
|
|
|
- // query: {
|
|
|
- // type,
|
|
|
- // id: row.id
|
|
|
- // }
|
|
|
- // });
|
|
|
- },
|
|
|
- // 修改计划
|
|
|
- planEdit({ id }) {
|
|
|
- this.$router.push({
|
|
|
- path: '/saleOrder/salesToProduction',
|
|
|
- query: {
|
|
|
- type: 'edit',
|
|
|
- id
|
|
|
+ return obj && obj.label;
|
|
|
+ },
|
|
|
+ /* 表格数据源 */
|
|
|
+ datasource({ page, limit, where }) {
|
|
|
+ return getList({
|
|
|
+ pageNum: page,
|
|
|
+ size: limit,
|
|
|
+ ...where,
|
|
|
+ ...this.sort
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 发布工单
|
|
|
+ handleOrderPublish(type, row) {
|
|
|
+ this.$confirm('发布工单后不可撤回,确定发布吗?', '发布确认')
|
|
|
+ .then(async () => {
|
|
|
+ const loading = this.$loading({
|
|
|
+ lock: true,
|
|
|
+ fullscreen: true,
|
|
|
+ text: '工单发布中...'
|
|
|
+ });
|
|
|
+ try {
|
|
|
+ let code = row.workOrderCode;
|
|
|
+ if (!code) {
|
|
|
+ code = await getCode('product_order_code');
|
|
|
+ }
|
|
|
+ // 反显对象会报错 status
|
|
|
+ const data = await release([row.id]);
|
|
|
+ if (data || data === 0) {
|
|
|
+ this.$message.success('发布成功!');
|
|
|
+ } else {
|
|
|
+ this.$message.error('发布失败,请重新发布!');
|
|
|
+ }
|
|
|
+ this.reload();
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error);
|
|
|
}
|
|
|
+ loading.close();
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ console.error(err);
|
|
|
});
|
|
|
- },
|
|
|
- handleTabChange() {
|
|
|
- this.$refs.searchRef.reset();
|
|
|
- },
|
|
|
|
|
|
- /* 刷新表格 */
|
|
|
- reload(where) {
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$refs.table.reload({ page: 1, where });
|
|
|
- });
|
|
|
- },
|
|
|
+ // this.$router.push({
|
|
|
+ // path: '/productionPlan/workOrderPublish',
|
|
|
+ // query: {
|
|
|
+ // type,
|
|
|
+ // id: row.id
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ },
|
|
|
+ // 修改计划
|
|
|
+ planEdit({ id }) {
|
|
|
+ this.$router.push({
|
|
|
+ path: '/saleOrder/salesToProduction',
|
|
|
+ query: {
|
|
|
+ type: 'edit',
|
|
|
+ id
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleTabChange() {
|
|
|
+ this.$refs.searchRef.reset();
|
|
|
+ },
|
|
|
|
|
|
- goDetail({ id }) {
|
|
|
- this.$router.push({
|
|
|
- path: '/productionPlan/detail/' + id
|
|
|
+ /* 刷新表格 */
|
|
|
+ reload(where) {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.table.reload({ page: 1, where });
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ goDetail({ id }) {
|
|
|
+ this.$router.push({
|
|
|
+ path: '/productionPlan/detail/' + id
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleDelete({ id }) {
|
|
|
+ this.$confirm('确定删除当前数据?', '提示')
|
|
|
+ .then(async () => {
|
|
|
+ await del(id);
|
|
|
+ this.$message.success('删除成功!');
|
|
|
+ this.reload();
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ console.error(err);
|
|
|
});
|
|
|
- },
|
|
|
- handleDelete({ id }) {
|
|
|
- this.$confirm('确定删除当前数据?', '提示')
|
|
|
- .then(async () => {
|
|
|
- await del(id);
|
|
|
- this.$message.success('删除成功!');
|
|
|
- this.reload();
|
|
|
- })
|
|
|
- .catch((err) => {
|
|
|
- console.error(err);
|
|
|
- });
|
|
|
- },
|
|
|
+ },
|
|
|
|
|
|
-
|
|
|
- onSortChange(e) {
|
|
|
- let sort = {
|
|
|
- orderBy: e.order,
|
|
|
- sortName: e.prop,
|
|
|
- }
|
|
|
- this.sort = sort
|
|
|
- this.reload()
|
|
|
-
|
|
|
- },
|
|
|
+ onSortChange(e) {
|
|
|
+ let sort = {
|
|
|
+ orderBy: e.order,
|
|
|
+ sortName: e.prop
|
|
|
+ };
|
|
|
+ this.sort = sort;
|
|
|
+ this.reload();
|
|
|
+ },
|
|
|
|
|
|
- sortTop(row) {
|
|
|
- row.priority = Number(row.priority) + 1;
|
|
|
- this.priorityChange(row);
|
|
|
- },
|
|
|
- sortBottom(row) {
|
|
|
- if (row.priority <= 1) {
|
|
|
- return;
|
|
|
- }
|
|
|
- row.priority = Number(row.priority) - 1;
|
|
|
- this.priorityChange(row);
|
|
|
- },
|
|
|
+ sortTop(row) {
|
|
|
+ row.priority = Number(row.priority) + 1;
|
|
|
+ this.priorityChange(row);
|
|
|
+ },
|
|
|
+ sortBottom(row) {
|
|
|
+ if (row.priority <= 1) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ row.priority = Number(row.priority) - 1;
|
|
|
+ this.priorityChange(row);
|
|
|
+ },
|
|
|
|
|
|
- priorityChange(row) {
|
|
|
- if (row.priority > 10) {
|
|
|
- row.priority = 10; // 如果大于 10,则设置为 10
|
|
|
- } else if (row.priority < 0) {
|
|
|
- row.priority = 0; // 如果小于 0,则设置为 0
|
|
|
- }
|
|
|
+ priorityChange(row) {
|
|
|
+ if (row.priority > 10) {
|
|
|
+ row.priority = 10; // 如果大于 10,则设置为 10
|
|
|
+ } else if (row.priority < 0) {
|
|
|
+ row.priority = 0; // 如果小于 0,则设置为 0
|
|
|
+ }
|
|
|
|
|
|
- this.priorityFn(row);
|
|
|
- },
|
|
|
- priorityFn: debounce(function (row) {
|
|
|
- let params = {
|
|
|
- id: row.id,
|
|
|
- priority: row.priority
|
|
|
- };
|
|
|
- updatePriority(params).then((res) => {});
|
|
|
- }, 800)
|
|
|
- }
|
|
|
- };
|
|
|
+ this.priorityFn(row);
|
|
|
+ },
|
|
|
+ priorityFn: debounce(function (row) {
|
|
|
+ let params = {
|
|
|
+ id: row.id,
|
|
|
+ priority: row.priority
|
|
|
+ };
|
|
|
+ updatePriority(params).then((res) => {});
|
|
|
+ }, 800)
|
|
|
+ }
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped></style>
|