fix:工序添加父级
This commit is contained in:
parent
ddb3c4743c
commit
69decccef5
|
|
@ -25,12 +25,7 @@
|
|||
</div>
|
||||
</el-header>
|
||||
<el-main class="nopadding">
|
||||
<scTable
|
||||
ref="table"
|
||||
:apiObj="apiObj"
|
||||
row-key="id"
|
||||
@selection-change="selectionChange"
|
||||
>
|
||||
<scTable ref="table" :apiObj="apiObj" row-key="id" stripe :params="params" :query="query" @selection-change="selectionChange">
|
||||
<el-table-column
|
||||
label="#"
|
||||
type="index"
|
||||
|
|
@ -112,10 +107,25 @@
|
|||
size="small"
|
||||
v-auth="'material.delete'"
|
||||
type="danger"
|
||||
>删除</el-button
|
||||
>
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-popconfirm>
|
||||
<el-button
|
||||
link
|
||||
size="small"
|
||||
v-if="scope.row.parent==null"
|
||||
@click="table_child(scope.row)"
|
||||
v-auth="'material.update'"
|
||||
type="primary"
|
||||
>添加子工序</el-button>
|
||||
<el-button
|
||||
link
|
||||
size="small"
|
||||
v-else
|
||||
@click="table_child_remove(scope.row)"
|
||||
v-auth="'material.update'"
|
||||
type="primary"
|
||||
>从父工序移除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</scTable>
|
||||
|
|
@ -127,6 +137,43 @@
|
|||
@success="handleSaveSuccess"
|
||||
@closed="dialog.save = false"
|
||||
></save-dialog>
|
||||
<el-dialog
|
||||
:title="添加子工序"
|
||||
v-model="visible"
|
||||
:size="1000"
|
||||
destroy-on-close
|
||||
>
|
||||
<el-form
|
||||
ref="dialogForm"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
label-position="right"
|
||||
label-width="100px"
|
||||
>
|
||||
<el-form-item label="父工序">
|
||||
<el-input v-model="currentItem.name" disabled></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="子工序" prop="selectValue">
|
||||
<el-select
|
||||
v-model="selectValue"
|
||||
clearable
|
||||
placeholder="选择子工序"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in proOptions"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-footer>
|
||||
<el-button type="primary" :loading="isSaveing" @click="submit">保存</el-button>
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
</el-footer>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import saveDialog from "./process_form.vue";
|
||||
|
|
@ -137,6 +184,7 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
params: {with_children:'yes'},
|
||||
apiObj: this.$API.mtm.process.list,
|
||||
search: {
|
||||
keyword: null,
|
||||
|
|
@ -163,10 +211,30 @@ export default {
|
|||
20:'切分',
|
||||
30:'结合'
|
||||
},
|
||||
baseCode :this.$TOOL.data.get('BASE_INFO').base.base_code
|
||||
currentItem:{},
|
||||
selectValue:[],
|
||||
visible:false,
|
||||
isSaveing:false,
|
||||
proOptions:[],
|
||||
baseCode :this.$TOOL.data.get('BASE_INFO').base.base_code,
|
||||
rules: {
|
||||
selectValue: [
|
||||
{ required: true, message: "请输选择子工序", trigger: "blur" },
|
||||
],
|
||||
},
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.getProcess();
|
||||
},
|
||||
methods: {
|
||||
getProcess(){
|
||||
let that = this;
|
||||
let params = {page: 0, parent__isnull: true, mtype: 10};
|
||||
that.$API.mtm.process.list.req(params).then((res) => {
|
||||
that.proOptions = res;
|
||||
});
|
||||
},
|
||||
handleChange(value) {
|
||||
console.log(value);
|
||||
console.log(this.form.belong_dept);
|
||||
|
|
@ -196,6 +264,40 @@ export default {
|
|||
this.$message.success("删除成功");
|
||||
}
|
||||
},
|
||||
table_child(row){
|
||||
let that = this;
|
||||
Object.assign(that.currentItem,row);
|
||||
this.visible = true;
|
||||
},
|
||||
submit(){
|
||||
let that = this;
|
||||
let obj = {};
|
||||
that.isSaveing = true;
|
||||
that.proOptions.forEach((item) => {
|
||||
if (item.id == that.selectValue) {
|
||||
obj.name = item.name;
|
||||
}
|
||||
})
|
||||
obj.parent = that.currentItem.id;
|
||||
that.$API.mtm.process.update.req(that.selectValue, obj).then((res) => {
|
||||
that.isSaveing = false;
|
||||
that.visible = false;
|
||||
that.$refs.table.refresh();
|
||||
that.getProcess();
|
||||
}).catch((err) => {
|
||||
that.isSaveing = false;
|
||||
})
|
||||
},
|
||||
table_child_remove(row){
|
||||
let that = this;
|
||||
let obj = {};
|
||||
obj.parent = null;
|
||||
obj.name = row.name;
|
||||
that.$API.mtm.process.update.req(row.id, obj).then((res) => {
|
||||
that.$refs.table.refresh();
|
||||
that.getProcess();
|
||||
})
|
||||
},
|
||||
//表格选择后回调事件
|
||||
selectionChange(selection) {
|
||||
this.selection = selection;
|
||||
|
|
|
|||
Loading…
Reference in New Issue